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 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
1372 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
1373 /// A pointer to the contents in the success state.
1374 /// Reading from this pointer when `result_ok` is not set is undefined.
1375 pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
1376 /// A pointer to the contents in the error state.
1377 /// Reading from this pointer when `result_ok` is set is undefined.
1378 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1381 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
1382 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
1383 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1384 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
1385 /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
1386 /// `err` or `result` depending on the state of `result_ok`.
1387 pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
1388 /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
1389 pub result_ok: bool,
1392 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
1393 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
1394 CResult_ChannelMonitorUpdateDecodeErrorZ {
1395 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
1396 result: Box::into_raw(Box::new(o)),
1402 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
1403 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
1404 CResult_ChannelMonitorUpdateDecodeErrorZ {
1405 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
1406 err: Box::into_raw(Box::new(e)),
1412 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
1413 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
1414 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
1415 fn drop(&mut self) {
1417 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1418 let _ = unsafe { Box::from_raw(self.contents.result) };
1421 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1422 let _ = unsafe { Box::from_raw(self.contents.err) };
1427 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
1428 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
1429 let contents = if o.result_ok {
1430 let result = unsafe { o.contents.result };
1431 unsafe { o.contents.result = std::ptr::null_mut() };
1432 CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
1434 let err = unsafe { o.contents.err };
1435 unsafe { o.contents.err = std::ptr::null_mut(); }
1436 CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
1440 result_ok: o.result_ok,
1444 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
1445 fn clone(&self) -> Self {
1447 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
1448 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
1451 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
1452 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1458 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
1459 /// but with all dynamically-allocated buffers duplicated in new buffers.
1460 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { orig.clone() }
1462 /// The contents of CResult_HTLCUpdateDecodeErrorZ
1463 pub union CResult_HTLCUpdateDecodeErrorZPtr {
1464 /// A pointer to the contents in the success state.
1465 /// Reading from this pointer when `result_ok` is not set is undefined.
1466 pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
1467 /// A pointer to the contents in the error state.
1468 /// Reading from this pointer when `result_ok` is set is undefined.
1469 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1472 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
1473 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
1474 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1475 pub struct CResult_HTLCUpdateDecodeErrorZ {
1476 /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
1477 /// `err` or `result` depending on the state of `result_ok`.
1478 pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
1479 /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
1480 pub result_ok: bool,
1483 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
1484 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
1485 CResult_HTLCUpdateDecodeErrorZ {
1486 contents: CResult_HTLCUpdateDecodeErrorZPtr {
1487 result: Box::into_raw(Box::new(o)),
1493 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
1494 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
1495 CResult_HTLCUpdateDecodeErrorZ {
1496 contents: CResult_HTLCUpdateDecodeErrorZPtr {
1497 err: Box::into_raw(Box::new(e)),
1503 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
1504 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
1505 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
1506 fn drop(&mut self) {
1508 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1509 let _ = unsafe { Box::from_raw(self.contents.result) };
1512 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1513 let _ = unsafe { Box::from_raw(self.contents.err) };
1518 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
1519 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
1520 let contents = if o.result_ok {
1521 let result = unsafe { o.contents.result };
1522 unsafe { o.contents.result = std::ptr::null_mut() };
1523 CResult_HTLCUpdateDecodeErrorZPtr { result }
1525 let err = unsafe { o.contents.err };
1526 unsafe { o.contents.err = std::ptr::null_mut(); }
1527 CResult_HTLCUpdateDecodeErrorZPtr { err }
1531 result_ok: o.result_ok,
1535 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
1536 fn clone(&self) -> Self {
1538 Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
1539 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
1542 Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
1543 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1549 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
1550 /// but with all dynamically-allocated buffers duplicated in new buffers.
1551 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { orig.clone() }
1553 /// The contents of CResult_NoneMonitorUpdateErrorZ
1554 pub union CResult_NoneMonitorUpdateErrorZPtr {
1555 /// Note that this value is always NULL, as there are no contents in the OK variant
1556 pub result: *mut std::ffi::c_void,
1557 /// A pointer to the contents in the error state.
1558 /// Reading from this pointer when `result_ok` is set is undefined.
1559 pub err: *mut crate::lightning::chain::channelmonitor::MonitorUpdateError,
1562 /// A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
1563 /// containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
1564 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1565 pub struct CResult_NoneMonitorUpdateErrorZ {
1566 /// The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
1567 /// `err` or `result` depending on the state of `result_ok`.
1568 pub contents: CResult_NoneMonitorUpdateErrorZPtr,
1569 /// Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
1570 pub result_ok: bool,
1573 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
1574 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_ok() -> CResult_NoneMonitorUpdateErrorZ {
1575 CResult_NoneMonitorUpdateErrorZ {
1576 contents: CResult_NoneMonitorUpdateErrorZPtr {
1577 result: std::ptr::null_mut(),
1583 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
1584 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_err(e: crate::lightning::chain::channelmonitor::MonitorUpdateError) -> CResult_NoneMonitorUpdateErrorZ {
1585 CResult_NoneMonitorUpdateErrorZ {
1586 contents: CResult_NoneMonitorUpdateErrorZPtr {
1587 err: Box::into_raw(Box::new(e)),
1593 /// Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
1594 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_free(_res: CResult_NoneMonitorUpdateErrorZ) { }
1595 impl Drop for CResult_NoneMonitorUpdateErrorZ {
1596 fn drop(&mut self) {
1599 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1600 let _ = unsafe { Box::from_raw(self.contents.err) };
1605 impl From<crate::c_types::CResultTempl<u8, crate::lightning::chain::channelmonitor::MonitorUpdateError>> for CResult_NoneMonitorUpdateErrorZ {
1606 fn from(mut o: crate::c_types::CResultTempl<u8, crate::lightning::chain::channelmonitor::MonitorUpdateError>) -> Self {
1607 let contents = if o.result_ok {
1608 let _ = unsafe { Box::from_raw(o.contents.result) };
1609 o.contents.result = std::ptr::null_mut();
1610 CResult_NoneMonitorUpdateErrorZPtr { result: std::ptr::null_mut() }
1612 let err = unsafe { o.contents.err };
1613 unsafe { o.contents.err = std::ptr::null_mut(); }
1614 CResult_NoneMonitorUpdateErrorZPtr { err }
1618 result_ok: o.result_ok,
1622 impl Clone for CResult_NoneMonitorUpdateErrorZ {
1623 fn clone(&self) -> Self {
1625 Self { result_ok: true, contents: CResult_NoneMonitorUpdateErrorZPtr {
1626 result: std::ptr::null_mut()
1629 Self { result_ok: false, contents: CResult_NoneMonitorUpdateErrorZPtr {
1630 err: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::MonitorUpdateError>::clone(unsafe { &*self.contents.err })))
1636 /// Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
1637 /// but with all dynamically-allocated buffers duplicated in new buffers.
1638 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_clone(orig: &CResult_NoneMonitorUpdateErrorZ) -> CResult_NoneMonitorUpdateErrorZ { orig.clone() }
1640 /// A tuple of 2 elements. See the individual fields for the types contained.
1641 pub struct C2Tuple_OutPointScriptZ {
1642 /// The element at position 0
1643 pub a: crate::lightning::chain::transaction::OutPoint,
1644 /// The element at position 1
1645 pub b: crate::c_types::derived::CVec_u8Z,
1647 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
1648 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
1655 impl C2Tuple_OutPointScriptZ {
1656 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
1660 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
1662 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
1663 C2Tuple_OutPointScriptZ { a, b, }
1667 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
1668 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
1670 /// A tuple of 2 elements. See the individual fields for the types contained.
1671 pub struct C2Tuple_u32ScriptZ {
1672 /// The element at position 0
1674 /// The element at position 1
1675 pub b: crate::c_types::derived::CVec_u8Z,
1677 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
1678 fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
1685 impl C2Tuple_u32ScriptZ {
1686 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
1690 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
1692 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
1693 C2Tuple_u32ScriptZ { a, b, }
1697 /// Frees any resources used by the C2Tuple_u32ScriptZ.
1698 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
1700 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
1701 /// This corresponds to std::vector in C++
1702 pub struct CVec_C2Tuple_u32ScriptZZ {
1703 /// The elements in the array.
1704 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1705 pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
1706 /// The number of elements pointed to by `data`.
1709 impl CVec_C2Tuple_u32ScriptZZ {
1710 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
1711 if self.datalen == 0 { return Vec::new(); }
1712 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1713 self.data = std::ptr::null_mut();
1717 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
1718 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1721 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
1722 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
1723 let datalen = v.len();
1724 let data = Box::into_raw(v.into_boxed_slice());
1725 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1729 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1730 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
1731 impl Drop for CVec_C2Tuple_u32ScriptZZ {
1732 fn drop(&mut self) {
1733 if self.datalen == 0 { return; }
1734 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1738 /// A tuple of 2 elements. See the individual fields for the types contained.
1739 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
1740 /// The element at position 0
1741 pub a: crate::c_types::ThirtyTwoBytes,
1742 /// The element at position 1
1743 pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
1745 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
1746 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
1753 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
1754 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
1758 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
1760 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 {
1761 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
1765 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
1766 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
1768 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
1769 /// This corresponds to std::vector in C++
1770 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
1771 /// The elements in the array.
1772 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1773 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
1774 /// The number of elements pointed to by `data`.
1777 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
1778 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
1779 if self.datalen == 0 { return Vec::new(); }
1780 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1781 self.data = std::ptr::null_mut();
1785 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
1786 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1789 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
1790 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
1791 let datalen = v.len();
1792 let data = Box::into_raw(v.into_boxed_slice());
1793 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1797 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1798 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
1799 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
1800 fn drop(&mut self) {
1801 if self.datalen == 0 { return; }
1802 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1806 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
1807 /// This corresponds to std::vector in C++
1808 pub struct CVec_MonitorEventZ {
1809 /// The elements in the array.
1810 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1811 pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
1812 /// The number of elements pointed to by `data`.
1815 impl CVec_MonitorEventZ {
1816 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
1817 if self.datalen == 0 { return Vec::new(); }
1818 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1819 self.data = std::ptr::null_mut();
1823 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
1824 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1827 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
1828 fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
1829 let datalen = v.len();
1830 let data = Box::into_raw(v.into_boxed_slice());
1831 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1835 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1836 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
1837 impl Drop for CVec_MonitorEventZ {
1838 fn drop(&mut self) {
1839 if self.datalen == 0 { return; }
1840 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1843 impl Clone for CVec_MonitorEventZ {
1844 fn clone(&self) -> Self {
1845 let mut res = Vec::new();
1846 if self.datalen == 0 { return Self::from(res); }
1847 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1852 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
1853 /// This corresponds to std::vector in C++
1854 pub struct CVec_EventZ {
1855 /// The elements in the array.
1856 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1857 pub data: *mut crate::lightning::util::events::Event,
1858 /// The number of elements pointed to by `data`.
1862 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
1863 if self.datalen == 0 { return Vec::new(); }
1864 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1865 self.data = std::ptr::null_mut();
1869 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
1870 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1873 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
1874 fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
1875 let datalen = v.len();
1876 let data = Box::into_raw(v.into_boxed_slice());
1877 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1881 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1882 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
1883 impl Drop for CVec_EventZ {
1884 fn drop(&mut self) {
1885 if self.datalen == 0 { return; }
1886 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1889 impl Clone for CVec_EventZ {
1890 fn clone(&self) -> Self {
1891 let mut res = Vec::new();
1892 if self.datalen == 0 { return Self::from(res); }
1893 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1898 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
1899 /// This corresponds to std::vector in C++
1900 pub struct CVec_TransactionZ {
1901 /// The elements in the array.
1902 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1903 pub data: *mut crate::c_types::Transaction,
1904 /// The number of elements pointed to by `data`.
1907 impl CVec_TransactionZ {
1908 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
1909 if self.datalen == 0 { return Vec::new(); }
1910 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1911 self.data = std::ptr::null_mut();
1915 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
1916 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1919 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
1920 fn from(v: Vec<crate::c_types::Transaction>) -> Self {
1921 let datalen = v.len();
1922 let data = Box::into_raw(v.into_boxed_slice());
1923 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1927 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1928 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
1929 impl Drop for CVec_TransactionZ {
1930 fn drop(&mut self) {
1931 if self.datalen == 0 { return; }
1932 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1936 /// A tuple of 2 elements. See the individual fields for the types contained.
1937 pub struct C2Tuple_usizeTransactionZ {
1938 /// The element at position 0
1940 /// The element at position 1
1941 pub b: crate::c_types::Transaction,
1943 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
1944 fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
1951 impl C2Tuple_usizeTransactionZ {
1952 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
1956 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
1958 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
1959 C2Tuple_usizeTransactionZ { a, b, }
1963 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
1964 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
1966 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
1967 /// This corresponds to std::vector in C++
1968 pub struct CVec_C2Tuple_usizeTransactionZZ {
1969 /// The elements in the array.
1970 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1971 pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
1972 /// The number of elements pointed to by `data`.
1975 impl CVec_C2Tuple_usizeTransactionZZ {
1976 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
1977 if self.datalen == 0 { return Vec::new(); }
1978 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1979 self.data = std::ptr::null_mut();
1983 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
1984 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1987 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
1988 fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
1989 let datalen = v.len();
1990 let data = Box::into_raw(v.into_boxed_slice());
1991 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1995 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1996 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
1997 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
1998 fn drop(&mut self) {
1999 if self.datalen == 0 { return; }
2000 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2004 /// A tuple of 2 elements. See the individual fields for the types contained.
2005 pub struct C2Tuple_u32TxOutZ {
2006 /// The element at position 0
2008 /// The element at position 1
2009 pub b: crate::c_types::TxOut,
2011 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
2012 fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
2019 impl C2Tuple_u32TxOutZ {
2020 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
2024 impl Clone for C2Tuple_u32TxOutZ {
2025 fn clone(&self) -> Self {
2033 /// Creates a new tuple which has the same data as `orig`
2034 /// but with all dynamically-allocated buffers duplicated in new buffers.
2035 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { orig.clone() }
2036 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
2038 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
2039 C2Tuple_u32TxOutZ { a, b, }
2043 /// Frees any resources used by the C2Tuple_u32TxOutZ.
2044 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
2046 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
2047 /// This corresponds to std::vector in C++
2048 pub struct CVec_C2Tuple_u32TxOutZZ {
2049 /// The elements in the array.
2050 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2051 pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
2052 /// The number of elements pointed to by `data`.
2055 impl CVec_C2Tuple_u32TxOutZZ {
2056 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
2057 if self.datalen == 0 { return Vec::new(); }
2058 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2059 self.data = std::ptr::null_mut();
2063 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
2064 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2067 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
2068 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
2069 let datalen = v.len();
2070 let data = Box::into_raw(v.into_boxed_slice());
2071 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2075 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2076 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
2077 impl Drop for CVec_C2Tuple_u32TxOutZZ {
2078 fn drop(&mut self) {
2079 if self.datalen == 0 { return; }
2080 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2083 impl Clone for CVec_C2Tuple_u32TxOutZZ {
2084 fn clone(&self) -> Self {
2085 let mut res = Vec::new();
2086 if self.datalen == 0 { return Self::from(res); }
2087 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2092 /// A tuple of 2 elements. See the individual fields for the types contained.
2093 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
2094 /// The element at position 0
2095 pub a: crate::c_types::ThirtyTwoBytes,
2096 /// The element at position 1
2097 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
2099 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
2100 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
2107 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
2108 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
2112 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
2114 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 {
2115 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
2119 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
2120 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
2122 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
2123 /// This corresponds to std::vector in C++
2124 pub struct CVec_TransactionOutputsZ {
2125 /// The elements in the array.
2126 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2127 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
2128 /// The number of elements pointed to by `data`.
2131 impl CVec_TransactionOutputsZ {
2132 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
2133 if self.datalen == 0 { return Vec::new(); }
2134 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2135 self.data = std::ptr::null_mut();
2139 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
2140 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2143 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
2144 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
2145 let datalen = v.len();
2146 let data = Box::into_raw(v.into_boxed_slice());
2147 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2151 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2152 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
2153 impl Drop for CVec_TransactionOutputsZ {
2154 fn drop(&mut self) {
2155 if self.datalen == 0 { return; }
2156 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2160 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
2161 /// This corresponds to std::vector in C++
2162 pub struct CVec_TxidZ {
2163 /// The elements in the array.
2164 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2165 pub data: *mut crate::c_types::ThirtyTwoBytes,
2166 /// The number of elements pointed to by `data`.
2170 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
2171 if self.datalen == 0 { return Vec::new(); }
2172 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2173 self.data = std::ptr::null_mut();
2177 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
2178 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2181 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
2182 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
2183 let datalen = v.len();
2184 let data = Box::into_raw(v.into_boxed_slice());
2185 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2189 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2190 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
2191 impl Drop for CVec_TxidZ {
2192 fn drop(&mut self) {
2193 if self.datalen == 0 { return; }
2194 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2198 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
2199 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
2200 /// Note that this value is always NULL, as there are no contents in the OK variant
2201 pub result: *mut std::ffi::c_void,
2202 /// A pointer to the contents in the error state.
2203 /// Reading from this pointer when `result_ok` is set is undefined.
2204 pub err: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr,
2207 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
2208 /// containing a () on success and a crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr on failure.
2209 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2210 pub struct CResult_NoneChannelMonitorUpdateErrZ {
2211 /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
2212 /// `err` or `result` depending on the state of `result_ok`.
2213 pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
2214 /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
2215 pub result_ok: bool,
2218 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
2219 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
2220 CResult_NoneChannelMonitorUpdateErrZ {
2221 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2222 result: std::ptr::null_mut(),
2228 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
2229 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
2230 CResult_NoneChannelMonitorUpdateErrZ {
2231 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2232 err: Box::into_raw(Box::new(e)),
2238 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
2239 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
2240 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
2241 fn drop(&mut self) {
2244 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2245 let _ = unsafe { Box::from_raw(self.contents.err) };
2250 impl From<crate::c_types::CResultTempl<u8, crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
2251 fn from(mut o: crate::c_types::CResultTempl<u8, crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr>) -> Self {
2252 let contents = if o.result_ok {
2253 let _ = unsafe { Box::from_raw(o.contents.result) };
2254 o.contents.result = std::ptr::null_mut();
2255 CResult_NoneChannelMonitorUpdateErrZPtr { result: std::ptr::null_mut() }
2257 let err = unsafe { o.contents.err };
2258 unsafe { o.contents.err = std::ptr::null_mut(); }
2259 CResult_NoneChannelMonitorUpdateErrZPtr { err }
2263 result_ok: o.result_ok,
2267 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
2268 fn clone(&self) -> Self {
2270 Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2271 result: std::ptr::null_mut()
2274 Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2275 err: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
2281 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
2282 /// but with all dynamically-allocated buffers duplicated in new buffers.
2283 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { orig.clone() }
2285 /// A tuple of 2 elements. See the individual fields for the types contained.
2286 pub struct C2Tuple_BlockHashChannelMonitorZ {
2287 /// The element at position 0
2288 pub a: crate::c_types::ThirtyTwoBytes,
2289 /// The element at position 1
2290 pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
2292 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
2293 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
2300 impl C2Tuple_BlockHashChannelMonitorZ {
2301 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
2305 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
2307 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
2308 C2Tuple_BlockHashChannelMonitorZ { a, b, }
2312 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
2313 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
2315 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
2316 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
2317 /// A pointer to the contents in the success state.
2318 /// Reading from this pointer when `result_ok` is not set is undefined.
2319 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
2320 /// A pointer to the contents in the error state.
2321 /// Reading from this pointer when `result_ok` is set is undefined.
2322 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2325 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
2326 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
2327 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2328 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
2329 /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
2330 /// `err` or `result` depending on the state of `result_ok`.
2331 pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
2332 /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
2333 pub result_ok: bool,
2336 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
2337 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
2338 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
2339 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
2340 result: Box::into_raw(Box::new(o)),
2346 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
2347 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
2348 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
2349 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
2350 err: Box::into_raw(Box::new(e)),
2356 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
2357 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
2358 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
2359 fn drop(&mut self) {
2361 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2362 let _ = unsafe { Box::from_raw(self.contents.result) };
2365 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2366 let _ = unsafe { Box::from_raw(self.contents.err) };
2371 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
2372 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
2373 let contents = if o.result_ok {
2374 let result = unsafe { o.contents.result };
2375 unsafe { o.contents.result = std::ptr::null_mut() };
2376 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
2378 let err = unsafe { o.contents.err };
2379 unsafe { o.contents.err = std::ptr::null_mut(); }
2380 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
2384 result_ok: o.result_ok,
2389 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
2390 /// This corresponds to std::vector in C++
2391 pub struct CVec_RouteHopZ {
2392 /// The elements in the array.
2393 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2394 pub data: *mut crate::lightning::routing::router::RouteHop,
2395 /// The number of elements pointed to by `data`.
2398 impl CVec_RouteHopZ {
2399 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
2400 if self.datalen == 0 { return Vec::new(); }
2401 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2402 self.data = std::ptr::null_mut();
2406 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
2407 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2410 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
2411 fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
2412 let datalen = v.len();
2413 let data = Box::into_raw(v.into_boxed_slice());
2414 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2418 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2419 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
2420 impl Drop for CVec_RouteHopZ {
2421 fn drop(&mut self) {
2422 if self.datalen == 0 { return; }
2423 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2426 impl Clone for CVec_RouteHopZ {
2427 fn clone(&self) -> Self {
2428 let mut res = Vec::new();
2429 if self.datalen == 0 { return Self::from(res); }
2430 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2435 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
2436 /// This corresponds to std::vector in C++
2437 pub struct CVec_CVec_RouteHopZZ {
2438 /// The elements in the array.
2439 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2440 pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
2441 /// The number of elements pointed to by `data`.
2444 impl CVec_CVec_RouteHopZZ {
2445 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
2446 if self.datalen == 0 { return Vec::new(); }
2447 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2448 self.data = std::ptr::null_mut();
2452 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
2453 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2456 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
2457 fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
2458 let datalen = v.len();
2459 let data = Box::into_raw(v.into_boxed_slice());
2460 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2464 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2465 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
2466 impl Drop for CVec_CVec_RouteHopZZ {
2467 fn drop(&mut self) {
2468 if self.datalen == 0 { return; }
2469 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2472 impl Clone for CVec_CVec_RouteHopZZ {
2473 fn clone(&self) -> Self {
2474 let mut res = Vec::new();
2475 if self.datalen == 0 { return Self::from(res); }
2476 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2481 /// The contents of CResult_RouteDecodeErrorZ
2482 pub union CResult_RouteDecodeErrorZPtr {
2483 /// A pointer to the contents in the success state.
2484 /// Reading from this pointer when `result_ok` is not set is undefined.
2485 pub result: *mut crate::lightning::routing::router::Route,
2486 /// A pointer to the contents in the error state.
2487 /// Reading from this pointer when `result_ok` is set is undefined.
2488 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2491 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
2492 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
2493 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2494 pub struct CResult_RouteDecodeErrorZ {
2495 /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
2496 /// `err` or `result` depending on the state of `result_ok`.
2497 pub contents: CResult_RouteDecodeErrorZPtr,
2498 /// Whether this CResult_RouteDecodeErrorZ represents a success state.
2499 pub result_ok: bool,
2502 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
2503 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
2504 CResult_RouteDecodeErrorZ {
2505 contents: CResult_RouteDecodeErrorZPtr {
2506 result: Box::into_raw(Box::new(o)),
2512 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
2513 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
2514 CResult_RouteDecodeErrorZ {
2515 contents: CResult_RouteDecodeErrorZPtr {
2516 err: Box::into_raw(Box::new(e)),
2522 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
2523 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
2524 impl Drop for CResult_RouteDecodeErrorZ {
2525 fn drop(&mut self) {
2527 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2528 let _ = unsafe { Box::from_raw(self.contents.result) };
2531 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2532 let _ = unsafe { Box::from_raw(self.contents.err) };
2537 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
2538 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
2539 let contents = if o.result_ok {
2540 let result = unsafe { o.contents.result };
2541 unsafe { o.contents.result = std::ptr::null_mut() };
2542 CResult_RouteDecodeErrorZPtr { result }
2544 let err = unsafe { o.contents.err };
2545 unsafe { o.contents.err = std::ptr::null_mut(); }
2546 CResult_RouteDecodeErrorZPtr { err }
2550 result_ok: o.result_ok,
2554 impl Clone for CResult_RouteDecodeErrorZ {
2555 fn clone(&self) -> Self {
2557 Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
2558 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2561 Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
2562 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2568 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
2569 /// but with all dynamically-allocated buffers duplicated in new buffers.
2570 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { orig.clone() }
2573 /// An enum which can either contain a u64 or not
2574 pub enum COption_u64Z {
2575 /// When we're in this state, this COption_u64Z contains a u64
2577 /// When we're in this state, this COption_u64Z contains nothing
2581 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2582 if let Self::Some(_) = self { true } else { false }
2584 #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
2585 if let Self::Some(v) = self { v } else { unreachable!() }
2589 /// Constructs a new COption_u64Z containing a u64
2590 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
2591 COption_u64Z::Some(o)
2594 /// Constructs a new COption_u64Z containing nothing
2595 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
2599 /// Frees any resources associated with the u64, if we are in the Some state
2600 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
2602 /// Creates a new COption_u64Z which has the same data as `orig`
2603 /// but with all dynamically-allocated buffers duplicated in new buffers.
2604 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { orig.clone() }
2606 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2607 /// This corresponds to std::vector in C++
2608 pub struct CVec_ChannelDetailsZ {
2609 /// The elements in the array.
2610 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2611 pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
2612 /// The number of elements pointed to by `data`.
2615 impl CVec_ChannelDetailsZ {
2616 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
2617 if self.datalen == 0 { return Vec::new(); }
2618 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2619 self.data = std::ptr::null_mut();
2623 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
2624 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2627 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
2628 fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
2629 let datalen = v.len();
2630 let data = Box::into_raw(v.into_boxed_slice());
2631 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2635 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2636 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
2637 impl Drop for CVec_ChannelDetailsZ {
2638 fn drop(&mut self) {
2639 if self.datalen == 0 { return; }
2640 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2643 impl Clone for CVec_ChannelDetailsZ {
2644 fn clone(&self) -> Self {
2645 let mut res = Vec::new();
2646 if self.datalen == 0 { return Self::from(res); }
2647 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2652 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
2653 /// This corresponds to std::vector in C++
2654 pub struct CVec_RouteHintZ {
2655 /// The elements in the array.
2656 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2657 pub data: *mut crate::lightning::routing::router::RouteHint,
2658 /// The number of elements pointed to by `data`.
2661 impl CVec_RouteHintZ {
2662 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
2663 if self.datalen == 0 { return Vec::new(); }
2664 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2665 self.data = std::ptr::null_mut();
2669 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
2670 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2673 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
2674 fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
2675 let datalen = v.len();
2676 let data = Box::into_raw(v.into_boxed_slice());
2677 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2681 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2682 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
2683 impl Drop for CVec_RouteHintZ {
2684 fn drop(&mut self) {
2685 if self.datalen == 0 { return; }
2686 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2689 impl Clone for CVec_RouteHintZ {
2690 fn clone(&self) -> Self {
2691 let mut res = Vec::new();
2692 if self.datalen == 0 { return Self::from(res); }
2693 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2698 /// The contents of CResult_RouteLightningErrorZ
2699 pub union CResult_RouteLightningErrorZPtr {
2700 /// A pointer to the contents in the success state.
2701 /// Reading from this pointer when `result_ok` is not set is undefined.
2702 pub result: *mut crate::lightning::routing::router::Route,
2703 /// A pointer to the contents in the error state.
2704 /// Reading from this pointer when `result_ok` is set is undefined.
2705 pub err: *mut crate::lightning::ln::msgs::LightningError,
2708 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2709 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2710 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2711 pub struct CResult_RouteLightningErrorZ {
2712 /// The contents of this CResult_RouteLightningErrorZ, accessible via either
2713 /// `err` or `result` depending on the state of `result_ok`.
2714 pub contents: CResult_RouteLightningErrorZPtr,
2715 /// Whether this CResult_RouteLightningErrorZ represents a success state.
2716 pub result_ok: bool,
2719 /// Creates a new CResult_RouteLightningErrorZ in the success state.
2720 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
2721 CResult_RouteLightningErrorZ {
2722 contents: CResult_RouteLightningErrorZPtr {
2723 result: Box::into_raw(Box::new(o)),
2729 /// Creates a new CResult_RouteLightningErrorZ in the error state.
2730 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
2731 CResult_RouteLightningErrorZ {
2732 contents: CResult_RouteLightningErrorZPtr {
2733 err: Box::into_raw(Box::new(e)),
2739 /// Frees any resources used by the CResult_RouteLightningErrorZ.
2740 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
2741 impl Drop for CResult_RouteLightningErrorZ {
2742 fn drop(&mut self) {
2744 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2745 let _ = unsafe { Box::from_raw(self.contents.result) };
2748 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2749 let _ = unsafe { Box::from_raw(self.contents.err) };
2754 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2755 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2756 let contents = if o.result_ok {
2757 let result = unsafe { o.contents.result };
2758 unsafe { o.contents.result = std::ptr::null_mut() };
2759 CResult_RouteLightningErrorZPtr { result }
2761 let err = unsafe { o.contents.err };
2762 unsafe { o.contents.err = std::ptr::null_mut(); }
2763 CResult_RouteLightningErrorZPtr { err }
2767 result_ok: o.result_ok,
2771 impl Clone for CResult_RouteLightningErrorZ {
2772 fn clone(&self) -> Self {
2774 Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2775 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2778 Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2779 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2785 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2786 /// but with all dynamically-allocated buffers duplicated in new buffers.
2787 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { orig.clone() }
2789 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
2790 /// This corresponds to std::vector in C++
2791 pub struct CVec_MessageSendEventZ {
2792 /// The elements in the array.
2793 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2794 pub data: *mut crate::lightning::util::events::MessageSendEvent,
2795 /// The number of elements pointed to by `data`.
2798 impl CVec_MessageSendEventZ {
2799 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
2800 if self.datalen == 0 { return Vec::new(); }
2801 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2802 self.data = std::ptr::null_mut();
2806 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
2807 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2810 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
2811 fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
2812 let datalen = v.len();
2813 let data = Box::into_raw(v.into_boxed_slice());
2814 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2818 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2819 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
2820 impl Drop for CVec_MessageSendEventZ {
2821 fn drop(&mut self) {
2822 if self.datalen == 0 { return; }
2823 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2826 impl Clone for CVec_MessageSendEventZ {
2827 fn clone(&self) -> Self {
2828 let mut res = Vec::new();
2829 if self.datalen == 0 { return Self::from(res); }
2830 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2835 /// The contents of CResult_boolLightningErrorZ
2836 pub union CResult_boolLightningErrorZPtr {
2837 /// A pointer to the contents in the success state.
2838 /// Reading from this pointer when `result_ok` is not set is undefined.
2839 pub result: *mut bool,
2840 /// A pointer to the contents in the error state.
2841 /// Reading from this pointer when `result_ok` is set is undefined.
2842 pub err: *mut crate::lightning::ln::msgs::LightningError,
2845 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
2846 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
2847 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2848 pub struct CResult_boolLightningErrorZ {
2849 /// The contents of this CResult_boolLightningErrorZ, accessible via either
2850 /// `err` or `result` depending on the state of `result_ok`.
2851 pub contents: CResult_boolLightningErrorZPtr,
2852 /// Whether this CResult_boolLightningErrorZ represents a success state.
2853 pub result_ok: bool,
2856 /// Creates a new CResult_boolLightningErrorZ in the success state.
2857 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
2858 CResult_boolLightningErrorZ {
2859 contents: CResult_boolLightningErrorZPtr {
2860 result: Box::into_raw(Box::new(o)),
2866 /// Creates a new CResult_boolLightningErrorZ in the error state.
2867 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
2868 CResult_boolLightningErrorZ {
2869 contents: CResult_boolLightningErrorZPtr {
2870 err: Box::into_raw(Box::new(e)),
2876 /// Frees any resources used by the CResult_boolLightningErrorZ.
2877 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
2878 impl Drop for CResult_boolLightningErrorZ {
2879 fn drop(&mut self) {
2881 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2882 let _ = unsafe { Box::from_raw(self.contents.result) };
2885 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2886 let _ = unsafe { Box::from_raw(self.contents.err) };
2891 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
2892 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
2893 let contents = if o.result_ok {
2894 let result = unsafe { o.contents.result };
2895 unsafe { o.contents.result = std::ptr::null_mut() };
2896 CResult_boolLightningErrorZPtr { result }
2898 let err = unsafe { o.contents.err };
2899 unsafe { o.contents.err = std::ptr::null_mut(); }
2900 CResult_boolLightningErrorZPtr { err }
2904 result_ok: o.result_ok,
2908 impl Clone for CResult_boolLightningErrorZ {
2909 fn clone(&self) -> Self {
2911 Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
2912 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
2915 Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
2916 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2922 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
2923 /// but with all dynamically-allocated buffers duplicated in new buffers.
2924 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { orig.clone() }
2926 /// A tuple of 3 elements. See the individual fields for the types contained.
2927 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
2928 /// The element at position 0
2929 pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
2930 /// The element at position 1
2931 pub b: crate::lightning::ln::msgs::ChannelUpdate,
2932 /// The element at position 2
2933 pub c: crate::lightning::ln::msgs::ChannelUpdate,
2935 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
2936 fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
2944 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
2945 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
2946 (self.a, self.b, self.c)
2949 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
2950 fn clone(&self) -> Self {
2959 /// Creates a new tuple which has the same data as `orig`
2960 /// but with all dynamically-allocated buffers duplicated in new buffers.
2961 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { orig.clone() }
2962 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
2964 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 {
2965 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
2969 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
2970 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
2972 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
2973 /// This corresponds to std::vector in C++
2974 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
2975 /// The elements in the array.
2976 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2977 pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
2978 /// The number of elements pointed to by `data`.
2981 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
2982 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
2983 if self.datalen == 0 { return Vec::new(); }
2984 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2985 self.data = std::ptr::null_mut();
2989 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
2990 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2993 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
2994 fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
2995 let datalen = v.len();
2996 let data = Box::into_raw(v.into_boxed_slice());
2997 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3001 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3002 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
3003 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
3004 fn drop(&mut self) {
3005 if self.datalen == 0 { return; }
3006 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3009 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
3010 fn clone(&self) -> Self {
3011 let mut res = Vec::new();
3012 if self.datalen == 0 { return Self::from(res); }
3013 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3018 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
3019 /// This corresponds to std::vector in C++
3020 pub struct CVec_NodeAnnouncementZ {
3021 /// The elements in the array.
3022 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3023 pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
3024 /// The number of elements pointed to by `data`.
3027 impl CVec_NodeAnnouncementZ {
3028 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
3029 if self.datalen == 0 { return Vec::new(); }
3030 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3031 self.data = std::ptr::null_mut();
3035 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
3036 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3039 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
3040 fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
3041 let datalen = v.len();
3042 let data = Box::into_raw(v.into_boxed_slice());
3043 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3047 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3048 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
3049 impl Drop for CVec_NodeAnnouncementZ {
3050 fn drop(&mut self) {
3051 if self.datalen == 0 { return; }
3052 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3055 impl Clone for CVec_NodeAnnouncementZ {
3056 fn clone(&self) -> Self {
3057 let mut res = Vec::new();
3058 if self.datalen == 0 { return Self::from(res); }
3059 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3064 /// The contents of CResult_NoneLightningErrorZ
3065 pub union CResult_NoneLightningErrorZPtr {
3066 /// Note that this value is always NULL, as there are no contents in the OK variant
3067 pub result: *mut std::ffi::c_void,
3068 /// A pointer to the contents in the error state.
3069 /// Reading from this pointer when `result_ok` is set is undefined.
3070 pub err: *mut crate::lightning::ln::msgs::LightningError,
3073 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
3074 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
3075 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3076 pub struct CResult_NoneLightningErrorZ {
3077 /// The contents of this CResult_NoneLightningErrorZ, accessible via either
3078 /// `err` or `result` depending on the state of `result_ok`.
3079 pub contents: CResult_NoneLightningErrorZPtr,
3080 /// Whether this CResult_NoneLightningErrorZ represents a success state.
3081 pub result_ok: bool,
3084 /// Creates a new CResult_NoneLightningErrorZ in the success state.
3085 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
3086 CResult_NoneLightningErrorZ {
3087 contents: CResult_NoneLightningErrorZPtr {
3088 result: std::ptr::null_mut(),
3094 /// Creates a new CResult_NoneLightningErrorZ in the error state.
3095 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
3096 CResult_NoneLightningErrorZ {
3097 contents: CResult_NoneLightningErrorZPtr {
3098 err: Box::into_raw(Box::new(e)),
3104 /// Frees any resources used by the CResult_NoneLightningErrorZ.
3105 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
3106 impl Drop for CResult_NoneLightningErrorZ {
3107 fn drop(&mut self) {
3110 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3111 let _ = unsafe { Box::from_raw(self.contents.err) };
3116 impl From<crate::c_types::CResultTempl<u8, crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
3117 fn from(mut o: crate::c_types::CResultTempl<u8, crate::lightning::ln::msgs::LightningError>) -> Self {
3118 let contents = if o.result_ok {
3119 let _ = unsafe { Box::from_raw(o.contents.result) };
3120 o.contents.result = std::ptr::null_mut();
3121 CResult_NoneLightningErrorZPtr { result: std::ptr::null_mut() }
3123 let err = unsafe { o.contents.err };
3124 unsafe { o.contents.err = std::ptr::null_mut(); }
3125 CResult_NoneLightningErrorZPtr { err }
3129 result_ok: o.result_ok,
3133 impl Clone for CResult_NoneLightningErrorZ {
3134 fn clone(&self) -> Self {
3136 Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
3137 result: std::ptr::null_mut()
3140 Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
3141 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
3147 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
3148 /// but with all dynamically-allocated buffers duplicated in new buffers.
3149 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { orig.clone() }
3151 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
3152 /// This corresponds to std::vector in C++
3153 pub struct CVec_PublicKeyZ {
3154 /// The elements in the array.
3155 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3156 pub data: *mut crate::c_types::PublicKey,
3157 /// The number of elements pointed to by `data`.
3160 impl CVec_PublicKeyZ {
3161 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
3162 if self.datalen == 0 { return Vec::new(); }
3163 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3164 self.data = std::ptr::null_mut();
3168 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
3169 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3172 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
3173 fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
3174 let datalen = v.len();
3175 let data = Box::into_raw(v.into_boxed_slice());
3176 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3180 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3181 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
3182 impl Drop for CVec_PublicKeyZ {
3183 fn drop(&mut self) {
3184 if self.datalen == 0 { return; }
3185 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3189 /// A dynamically-allocated array of u8s of arbitrary size.
3190 /// This corresponds to std::vector in C++
3191 pub struct CVec_u8Z {
3192 /// The elements in the array.
3193 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3195 /// The number of elements pointed to by `data`.
3199 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
3200 if self.datalen == 0 { return Vec::new(); }
3201 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3202 self.data = std::ptr::null_mut();
3206 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
3207 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3210 impl From<Vec<u8>> for CVec_u8Z {
3211 fn from(v: Vec<u8>) -> Self {
3212 let datalen = v.len();
3213 let data = Box::into_raw(v.into_boxed_slice());
3214 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3218 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3219 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
3220 impl Drop for CVec_u8Z {
3221 fn drop(&mut self) {
3222 if self.datalen == 0 { return; }
3223 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3226 impl Clone for CVec_u8Z {
3227 fn clone(&self) -> Self {
3228 let mut res = Vec::new();
3229 if self.datalen == 0 { return Self::from(res); }
3230 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3235 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
3236 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
3237 /// A pointer to the contents in the success state.
3238 /// Reading from this pointer when `result_ok` is not set is undefined.
3239 pub result: *mut crate::c_types::derived::CVec_u8Z,
3240 /// A pointer to the contents in the error state.
3241 /// Reading from this pointer when `result_ok` is set is undefined.
3242 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
3245 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
3246 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
3247 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3248 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
3249 /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
3250 /// `err` or `result` depending on the state of `result_ok`.
3251 pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
3252 /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
3253 pub result_ok: bool,
3256 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
3257 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
3258 CResult_CVec_u8ZPeerHandleErrorZ {
3259 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
3260 result: Box::into_raw(Box::new(o)),
3266 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
3267 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
3268 CResult_CVec_u8ZPeerHandleErrorZ {
3269 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
3270 err: Box::into_raw(Box::new(e)),
3276 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
3277 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
3278 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
3279 fn drop(&mut self) {
3281 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3282 let _ = unsafe { Box::from_raw(self.contents.result) };
3285 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3286 let _ = unsafe { Box::from_raw(self.contents.err) };
3291 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
3292 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
3293 let contents = if o.result_ok {
3294 let result = unsafe { o.contents.result };
3295 unsafe { o.contents.result = std::ptr::null_mut() };
3296 CResult_CVec_u8ZPeerHandleErrorZPtr { result }
3298 let err = unsafe { o.contents.err };
3299 unsafe { o.contents.err = std::ptr::null_mut(); }
3300 CResult_CVec_u8ZPeerHandleErrorZPtr { err }
3304 result_ok: o.result_ok,
3308 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
3309 fn clone(&self) -> Self {
3311 Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
3312 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
3315 Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
3316 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
3322 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
3323 /// but with all dynamically-allocated buffers duplicated in new buffers.
3324 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { orig.clone() }
3326 /// The contents of CResult_NonePeerHandleErrorZ
3327 pub union CResult_NonePeerHandleErrorZPtr {
3328 /// Note that this value is always NULL, as there are no contents in the OK variant
3329 pub result: *mut std::ffi::c_void,
3330 /// A pointer to the contents in the error state.
3331 /// Reading from this pointer when `result_ok` is set is undefined.
3332 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
3335 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
3336 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
3337 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3338 pub struct CResult_NonePeerHandleErrorZ {
3339 /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
3340 /// `err` or `result` depending on the state of `result_ok`.
3341 pub contents: CResult_NonePeerHandleErrorZPtr,
3342 /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
3343 pub result_ok: bool,
3346 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
3347 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
3348 CResult_NonePeerHandleErrorZ {
3349 contents: CResult_NonePeerHandleErrorZPtr {
3350 result: std::ptr::null_mut(),
3356 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
3357 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
3358 CResult_NonePeerHandleErrorZ {
3359 contents: CResult_NonePeerHandleErrorZPtr {
3360 err: Box::into_raw(Box::new(e)),
3366 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
3367 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
3368 impl Drop for CResult_NonePeerHandleErrorZ {
3369 fn drop(&mut self) {
3372 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3373 let _ = unsafe { Box::from_raw(self.contents.err) };
3378 impl From<crate::c_types::CResultTempl<u8, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
3379 fn from(mut o: crate::c_types::CResultTempl<u8, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
3380 let contents = if o.result_ok {
3381 let _ = unsafe { Box::from_raw(o.contents.result) };
3382 o.contents.result = std::ptr::null_mut();
3383 CResult_NonePeerHandleErrorZPtr { result: std::ptr::null_mut() }
3385 let err = unsafe { o.contents.err };
3386 unsafe { o.contents.err = std::ptr::null_mut(); }
3387 CResult_NonePeerHandleErrorZPtr { err }
3391 result_ok: o.result_ok,
3395 impl Clone for CResult_NonePeerHandleErrorZ {
3396 fn clone(&self) -> Self {
3398 Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
3399 result: std::ptr::null_mut()
3402 Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
3403 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
3409 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
3410 /// but with all dynamically-allocated buffers duplicated in new buffers.
3411 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { orig.clone() }
3413 /// The contents of CResult_boolPeerHandleErrorZ
3414 pub union CResult_boolPeerHandleErrorZPtr {
3415 /// A pointer to the contents in the success state.
3416 /// Reading from this pointer when `result_ok` is not set is undefined.
3417 pub result: *mut bool,
3418 /// A pointer to the contents in the error state.
3419 /// Reading from this pointer when `result_ok` is set is undefined.
3420 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
3423 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
3424 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
3425 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3426 pub struct CResult_boolPeerHandleErrorZ {
3427 /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
3428 /// `err` or `result` depending on the state of `result_ok`.
3429 pub contents: CResult_boolPeerHandleErrorZPtr,
3430 /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
3431 pub result_ok: bool,
3434 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
3435 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
3436 CResult_boolPeerHandleErrorZ {
3437 contents: CResult_boolPeerHandleErrorZPtr {
3438 result: Box::into_raw(Box::new(o)),
3444 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
3445 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
3446 CResult_boolPeerHandleErrorZ {
3447 contents: CResult_boolPeerHandleErrorZPtr {
3448 err: Box::into_raw(Box::new(e)),
3454 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
3455 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
3456 impl Drop for CResult_boolPeerHandleErrorZ {
3457 fn drop(&mut self) {
3459 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3460 let _ = unsafe { Box::from_raw(self.contents.result) };
3463 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3464 let _ = unsafe { Box::from_raw(self.contents.err) };
3469 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
3470 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
3471 let contents = if o.result_ok {
3472 let result = unsafe { o.contents.result };
3473 unsafe { o.contents.result = std::ptr::null_mut() };
3474 CResult_boolPeerHandleErrorZPtr { result }
3476 let err = unsafe { o.contents.err };
3477 unsafe { o.contents.err = std::ptr::null_mut(); }
3478 CResult_boolPeerHandleErrorZPtr { err }
3482 result_ok: o.result_ok,
3486 impl Clone for CResult_boolPeerHandleErrorZ {
3487 fn clone(&self) -> Self {
3489 Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
3490 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
3493 Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
3494 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
3500 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
3501 /// but with all dynamically-allocated buffers duplicated in new buffers.
3502 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { orig.clone() }
3504 /// The contents of CResult_TxOutAccessErrorZ
3505 pub union CResult_TxOutAccessErrorZPtr {
3506 /// A pointer to the contents in the success state.
3507 /// Reading from this pointer when `result_ok` is not set is undefined.
3508 pub result: *mut crate::c_types::TxOut,
3509 /// A pointer to the contents in the error state.
3510 /// Reading from this pointer when `result_ok` is set is undefined.
3511 pub err: *mut crate::lightning::chain::AccessError,
3514 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
3515 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
3516 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3517 pub struct CResult_TxOutAccessErrorZ {
3518 /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
3519 /// `err` or `result` depending on the state of `result_ok`.
3520 pub contents: CResult_TxOutAccessErrorZPtr,
3521 /// Whether this CResult_TxOutAccessErrorZ represents a success state.
3522 pub result_ok: bool,
3525 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
3526 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
3527 CResult_TxOutAccessErrorZ {
3528 contents: CResult_TxOutAccessErrorZPtr {
3529 result: Box::into_raw(Box::new(o)),
3535 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
3536 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
3537 CResult_TxOutAccessErrorZ {
3538 contents: CResult_TxOutAccessErrorZPtr {
3539 err: Box::into_raw(Box::new(e)),
3545 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
3546 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
3547 impl Drop for CResult_TxOutAccessErrorZ {
3548 fn drop(&mut self) {
3550 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3551 let _ = unsafe { Box::from_raw(self.contents.result) };
3554 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3555 let _ = unsafe { Box::from_raw(self.contents.err) };
3560 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
3561 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
3562 let contents = if o.result_ok {
3563 let result = unsafe { o.contents.result };
3564 unsafe { o.contents.result = std::ptr::null_mut() };
3565 CResult_TxOutAccessErrorZPtr { result }
3567 let err = unsafe { o.contents.err };
3568 unsafe { o.contents.err = std::ptr::null_mut(); }
3569 CResult_TxOutAccessErrorZPtr { err }
3573 result_ok: o.result_ok,
3577 impl Clone for CResult_TxOutAccessErrorZ {
3578 fn clone(&self) -> Self {
3580 Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
3581 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
3584 Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
3585 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
3591 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
3592 /// but with all dynamically-allocated buffers duplicated in new buffers.
3593 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { orig.clone() }
3595 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
3596 pub enum COption_C2Tuple_usizeTransactionZZ {
3597 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
3598 Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
3599 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
3602 impl COption_C2Tuple_usizeTransactionZZ {
3603 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3604 if let Self::Some(_) = self { true } else { false }
3606 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
3607 if let Self::Some(v) = self { v } else { unreachable!() }
3611 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
3612 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
3613 COption_C2Tuple_usizeTransactionZZ::Some(o)
3616 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
3617 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
3618 COption_C2Tuple_usizeTransactionZZ::None
3621 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
3622 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
3624 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
3625 /// This corresponds to std::vector in C++
3626 pub struct CVec_SpendableOutputDescriptorZ {
3627 /// The elements in the array.
3628 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3629 pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3630 /// The number of elements pointed to by `data`.
3633 impl CVec_SpendableOutputDescriptorZ {
3634 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
3635 if self.datalen == 0 { return Vec::new(); }
3636 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3637 self.data = std::ptr::null_mut();
3641 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
3642 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3645 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
3646 fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
3647 let datalen = v.len();
3648 let data = Box::into_raw(v.into_boxed_slice());
3649 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3653 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3654 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
3655 impl Drop for CVec_SpendableOutputDescriptorZ {
3656 fn drop(&mut self) {
3657 if self.datalen == 0 { return; }
3658 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3661 impl Clone for CVec_SpendableOutputDescriptorZ {
3662 fn clone(&self) -> Self {
3663 let mut res = Vec::new();
3664 if self.datalen == 0 { return Self::from(res); }
3665 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3670 /// The contents of CResult_DirectionalChannelInfoDecodeErrorZ
3671 pub union CResult_DirectionalChannelInfoDecodeErrorZPtr {
3672 /// A pointer to the contents in the success state.
3673 /// Reading from this pointer when `result_ok` is not set is undefined.
3674 pub result: *mut crate::lightning::routing::network_graph::DirectionalChannelInfo,
3675 /// A pointer to the contents in the error state.
3676 /// Reading from this pointer when `result_ok` is set is undefined.
3677 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3680 /// A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
3681 /// containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
3682 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3683 pub struct CResult_DirectionalChannelInfoDecodeErrorZ {
3684 /// The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
3685 /// `err` or `result` depending on the state of `result_ok`.
3686 pub contents: CResult_DirectionalChannelInfoDecodeErrorZPtr,
3687 /// Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
3688 pub result_ok: bool,
3691 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
3692 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::DirectionalChannelInfo) -> CResult_DirectionalChannelInfoDecodeErrorZ {
3693 CResult_DirectionalChannelInfoDecodeErrorZ {
3694 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
3695 result: Box::into_raw(Box::new(o)),
3701 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
3702 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DirectionalChannelInfoDecodeErrorZ {
3703 CResult_DirectionalChannelInfoDecodeErrorZ {
3704 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
3705 err: Box::into_raw(Box::new(e)),
3711 /// Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
3712 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_free(_res: CResult_DirectionalChannelInfoDecodeErrorZ) { }
3713 impl Drop for CResult_DirectionalChannelInfoDecodeErrorZ {
3714 fn drop(&mut self) {
3716 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3717 let _ = unsafe { Box::from_raw(self.contents.result) };
3720 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3721 let _ = unsafe { Box::from_raw(self.contents.err) };
3726 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_DirectionalChannelInfoDecodeErrorZ {
3727 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
3728 let contents = if o.result_ok {
3729 let result = unsafe { o.contents.result };
3730 unsafe { o.contents.result = std::ptr::null_mut() };
3731 CResult_DirectionalChannelInfoDecodeErrorZPtr { result }
3733 let err = unsafe { o.contents.err };
3734 unsafe { o.contents.err = std::ptr::null_mut(); }
3735 CResult_DirectionalChannelInfoDecodeErrorZPtr { err }
3739 result_ok: o.result_ok,
3743 impl Clone for CResult_DirectionalChannelInfoDecodeErrorZ {
3744 fn clone(&self) -> Self {
3746 Self { result_ok: true, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
3747 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::DirectionalChannelInfo>::clone(unsafe { &*self.contents.result })))
3750 Self { result_ok: false, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
3751 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3757 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
3758 /// but with all dynamically-allocated buffers duplicated in new buffers.
3759 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig: &CResult_DirectionalChannelInfoDecodeErrorZ) -> CResult_DirectionalChannelInfoDecodeErrorZ { orig.clone() }
3761 /// The contents of CResult_ChannelInfoDecodeErrorZ
3762 pub union CResult_ChannelInfoDecodeErrorZPtr {
3763 /// A pointer to the contents in the success state.
3764 /// Reading from this pointer when `result_ok` is not set is undefined.
3765 pub result: *mut crate::lightning::routing::network_graph::ChannelInfo,
3766 /// A pointer to the contents in the error state.
3767 /// Reading from this pointer when `result_ok` is set is undefined.
3768 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3771 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
3772 /// containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
3773 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3774 pub struct CResult_ChannelInfoDecodeErrorZ {
3775 /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
3776 /// `err` or `result` depending on the state of `result_ok`.
3777 pub contents: CResult_ChannelInfoDecodeErrorZPtr,
3778 /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
3779 pub result_ok: bool,
3782 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
3783 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
3784 CResult_ChannelInfoDecodeErrorZ {
3785 contents: CResult_ChannelInfoDecodeErrorZPtr {
3786 result: Box::into_raw(Box::new(o)),
3792 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
3793 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
3794 CResult_ChannelInfoDecodeErrorZ {
3795 contents: CResult_ChannelInfoDecodeErrorZPtr {
3796 err: Box::into_raw(Box::new(e)),
3802 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
3803 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
3804 impl Drop for CResult_ChannelInfoDecodeErrorZ {
3805 fn drop(&mut self) {
3807 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3808 let _ = unsafe { Box::from_raw(self.contents.result) };
3811 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3812 let _ = unsafe { Box::from_raw(self.contents.err) };
3817 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
3818 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
3819 let contents = if o.result_ok {
3820 let result = unsafe { o.contents.result };
3821 unsafe { o.contents.result = std::ptr::null_mut() };
3822 CResult_ChannelInfoDecodeErrorZPtr { result }
3824 let err = unsafe { o.contents.err };
3825 unsafe { o.contents.err = std::ptr::null_mut(); }
3826 CResult_ChannelInfoDecodeErrorZPtr { err }
3830 result_ok: o.result_ok,
3834 impl Clone for CResult_ChannelInfoDecodeErrorZ {
3835 fn clone(&self) -> Self {
3837 Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
3838 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
3841 Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
3842 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3848 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
3849 /// but with all dynamically-allocated buffers duplicated in new buffers.
3850 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { orig.clone() }
3852 /// The contents of CResult_RoutingFeesDecodeErrorZ
3853 pub union CResult_RoutingFeesDecodeErrorZPtr {
3854 /// A pointer to the contents in the success state.
3855 /// Reading from this pointer when `result_ok` is not set is undefined.
3856 pub result: *mut crate::lightning::routing::network_graph::RoutingFees,
3857 /// A pointer to the contents in the error state.
3858 /// Reading from this pointer when `result_ok` is set is undefined.
3859 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3862 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
3863 /// containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
3864 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3865 pub struct CResult_RoutingFeesDecodeErrorZ {
3866 /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
3867 /// `err` or `result` depending on the state of `result_ok`.
3868 pub contents: CResult_RoutingFeesDecodeErrorZPtr,
3869 /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
3870 pub result_ok: bool,
3873 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
3874 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
3875 CResult_RoutingFeesDecodeErrorZ {
3876 contents: CResult_RoutingFeesDecodeErrorZPtr {
3877 result: Box::into_raw(Box::new(o)),
3883 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
3884 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
3885 CResult_RoutingFeesDecodeErrorZ {
3886 contents: CResult_RoutingFeesDecodeErrorZPtr {
3887 err: Box::into_raw(Box::new(e)),
3893 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
3894 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
3895 impl Drop for CResult_RoutingFeesDecodeErrorZ {
3896 fn drop(&mut self) {
3898 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3899 let _ = unsafe { Box::from_raw(self.contents.result) };
3902 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3903 let _ = unsafe { Box::from_raw(self.contents.err) };
3908 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
3909 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
3910 let contents = if o.result_ok {
3911 let result = unsafe { o.contents.result };
3912 unsafe { o.contents.result = std::ptr::null_mut() };
3913 CResult_RoutingFeesDecodeErrorZPtr { result }
3915 let err = unsafe { o.contents.err };
3916 unsafe { o.contents.err = std::ptr::null_mut(); }
3917 CResult_RoutingFeesDecodeErrorZPtr { err }
3921 result_ok: o.result_ok,
3925 impl Clone for CResult_RoutingFeesDecodeErrorZ {
3926 fn clone(&self) -> Self {
3928 Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
3929 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
3932 Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
3933 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3939 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
3940 /// but with all dynamically-allocated buffers duplicated in new buffers.
3941 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { orig.clone() }
3943 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
3944 /// This corresponds to std::vector in C++
3945 pub struct CVec_NetAddressZ {
3946 /// The elements in the array.
3947 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3948 pub data: *mut crate::lightning::ln::msgs::NetAddress,
3949 /// The number of elements pointed to by `data`.
3952 impl CVec_NetAddressZ {
3953 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
3954 if self.datalen == 0 { return Vec::new(); }
3955 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3956 self.data = std::ptr::null_mut();
3960 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
3961 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3964 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
3965 fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
3966 let datalen = v.len();
3967 let data = Box::into_raw(v.into_boxed_slice());
3968 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3972 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3973 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
3974 impl Drop for CVec_NetAddressZ {
3975 fn drop(&mut self) {
3976 if self.datalen == 0 { return; }
3977 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3980 impl Clone for CVec_NetAddressZ {
3981 fn clone(&self) -> Self {
3982 let mut res = Vec::new();
3983 if self.datalen == 0 { return Self::from(res); }
3984 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3989 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
3990 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
3991 /// A pointer to the contents in the success state.
3992 /// Reading from this pointer when `result_ok` is not set is undefined.
3993 pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
3994 /// A pointer to the contents in the error state.
3995 /// Reading from this pointer when `result_ok` is set is undefined.
3996 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3999 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
4000 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4001 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4002 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
4003 /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
4004 /// `err` or `result` depending on the state of `result_ok`.
4005 pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
4006 /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
4007 pub result_ok: bool,
4010 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
4011 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
4012 CResult_NodeAnnouncementInfoDecodeErrorZ {
4013 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
4014 result: Box::into_raw(Box::new(o)),
4020 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
4021 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
4022 CResult_NodeAnnouncementInfoDecodeErrorZ {
4023 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
4024 err: Box::into_raw(Box::new(e)),
4030 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
4031 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
4032 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
4033 fn drop(&mut self) {
4035 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4036 let _ = unsafe { Box::from_raw(self.contents.result) };
4039 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4040 let _ = unsafe { Box::from_raw(self.contents.err) };
4045 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
4046 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
4047 let contents = if o.result_ok {
4048 let result = unsafe { o.contents.result };
4049 unsafe { o.contents.result = std::ptr::null_mut() };
4050 CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
4052 let err = unsafe { o.contents.err };
4053 unsafe { o.contents.err = std::ptr::null_mut(); }
4054 CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
4058 result_ok: o.result_ok,
4062 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
4063 fn clone(&self) -> Self {
4065 Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
4066 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
4069 Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
4070 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4076 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
4077 /// but with all dynamically-allocated buffers duplicated in new buffers.
4078 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { orig.clone() }
4080 /// A dynamically-allocated array of u64s of arbitrary size.
4081 /// This corresponds to std::vector in C++
4082 pub struct CVec_u64Z {
4083 /// The elements in the array.
4084 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4086 /// The number of elements pointed to by `data`.
4090 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
4091 if self.datalen == 0 { return Vec::new(); }
4092 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4093 self.data = std::ptr::null_mut();
4097 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
4098 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4101 impl From<Vec<u64>> for CVec_u64Z {
4102 fn from(v: Vec<u64>) -> Self {
4103 let datalen = v.len();
4104 let data = Box::into_raw(v.into_boxed_slice());
4105 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4109 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4110 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
4111 impl Drop for CVec_u64Z {
4112 fn drop(&mut self) {
4113 if self.datalen == 0 { return; }
4114 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4117 impl Clone for CVec_u64Z {
4118 fn clone(&self) -> Self {
4119 let mut res = Vec::new();
4120 if self.datalen == 0 { return Self::from(res); }
4121 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4126 /// The contents of CResult_NodeInfoDecodeErrorZ
4127 pub union CResult_NodeInfoDecodeErrorZPtr {
4128 /// A pointer to the contents in the success state.
4129 /// Reading from this pointer when `result_ok` is not set is undefined.
4130 pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
4131 /// A pointer to the contents in the error state.
4132 /// Reading from this pointer when `result_ok` is set is undefined.
4133 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4136 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
4137 /// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4138 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4139 pub struct CResult_NodeInfoDecodeErrorZ {
4140 /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
4141 /// `err` or `result` depending on the state of `result_ok`.
4142 pub contents: CResult_NodeInfoDecodeErrorZPtr,
4143 /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
4144 pub result_ok: bool,
4147 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
4148 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
4149 CResult_NodeInfoDecodeErrorZ {
4150 contents: CResult_NodeInfoDecodeErrorZPtr {
4151 result: Box::into_raw(Box::new(o)),
4157 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
4158 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
4159 CResult_NodeInfoDecodeErrorZ {
4160 contents: CResult_NodeInfoDecodeErrorZPtr {
4161 err: Box::into_raw(Box::new(e)),
4167 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
4168 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
4169 impl Drop for CResult_NodeInfoDecodeErrorZ {
4170 fn drop(&mut self) {
4172 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4173 let _ = unsafe { Box::from_raw(self.contents.result) };
4176 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4177 let _ = unsafe { Box::from_raw(self.contents.err) };
4182 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
4183 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
4184 let contents = if o.result_ok {
4185 let result = unsafe { o.contents.result };
4186 unsafe { o.contents.result = std::ptr::null_mut() };
4187 CResult_NodeInfoDecodeErrorZPtr { result }
4189 let err = unsafe { o.contents.err };
4190 unsafe { o.contents.err = std::ptr::null_mut(); }
4191 CResult_NodeInfoDecodeErrorZPtr { err }
4195 result_ok: o.result_ok,
4199 impl Clone for CResult_NodeInfoDecodeErrorZ {
4200 fn clone(&self) -> Self {
4202 Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
4203 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
4206 Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
4207 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4213 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
4214 /// but with all dynamically-allocated buffers duplicated in new buffers.
4215 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { orig.clone() }
4217 /// The contents of CResult_NetworkGraphDecodeErrorZ
4218 pub union CResult_NetworkGraphDecodeErrorZPtr {
4219 /// A pointer to the contents in the success state.
4220 /// Reading from this pointer when `result_ok` is not set is undefined.
4221 pub result: *mut crate::lightning::routing::network_graph::NetworkGraph,
4222 /// A pointer to the contents in the error state.
4223 /// Reading from this pointer when `result_ok` is set is undefined.
4224 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4227 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
4228 /// containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
4229 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4230 pub struct CResult_NetworkGraphDecodeErrorZ {
4231 /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
4232 /// `err` or `result` depending on the state of `result_ok`.
4233 pub contents: CResult_NetworkGraphDecodeErrorZPtr,
4234 /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
4235 pub result_ok: bool,
4238 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
4239 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
4240 CResult_NetworkGraphDecodeErrorZ {
4241 contents: CResult_NetworkGraphDecodeErrorZPtr {
4242 result: Box::into_raw(Box::new(o)),
4248 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
4249 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
4250 CResult_NetworkGraphDecodeErrorZ {
4251 contents: CResult_NetworkGraphDecodeErrorZPtr {
4252 err: Box::into_raw(Box::new(e)),
4258 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
4259 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
4260 impl Drop for CResult_NetworkGraphDecodeErrorZ {
4261 fn drop(&mut self) {
4263 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4264 let _ = unsafe { Box::from_raw(self.contents.result) };
4267 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4268 let _ = unsafe { Box::from_raw(self.contents.err) };
4273 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
4274 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
4275 let contents = if o.result_ok {
4276 let result = unsafe { o.contents.result };
4277 unsafe { o.contents.result = std::ptr::null_mut() };
4278 CResult_NetworkGraphDecodeErrorZPtr { result }
4280 let err = unsafe { o.contents.err };
4281 unsafe { o.contents.err = std::ptr::null_mut(); }
4282 CResult_NetworkGraphDecodeErrorZPtr { err }
4286 result_ok: o.result_ok,
4290 impl Clone for CResult_NetworkGraphDecodeErrorZ {
4291 fn clone(&self) -> Self {
4293 Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
4294 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
4297 Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
4298 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4304 /// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
4305 /// but with all dynamically-allocated buffers duplicated in new buffers.
4306 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { orig.clone() }
4308 /// The contents of CResult_InitFeaturesDecodeErrorZ
4309 pub union CResult_InitFeaturesDecodeErrorZPtr {
4310 /// A pointer to the contents in the success state.
4311 /// Reading from this pointer when `result_ok` is not set is undefined.
4312 pub result: *mut crate::lightning::ln::features::InitFeatures,
4313 /// A pointer to the contents in the error state.
4314 /// Reading from this pointer when `result_ok` is set is undefined.
4315 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4318 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4319 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4320 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4321 pub struct CResult_InitFeaturesDecodeErrorZ {
4322 /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4323 /// `err` or `result` depending on the state of `result_ok`.
4324 pub contents: CResult_InitFeaturesDecodeErrorZPtr,
4325 /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4326 pub result_ok: bool,
4329 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
4330 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
4331 CResult_InitFeaturesDecodeErrorZ {
4332 contents: CResult_InitFeaturesDecodeErrorZPtr {
4333 result: Box::into_raw(Box::new(o)),
4339 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
4340 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
4341 CResult_InitFeaturesDecodeErrorZ {
4342 contents: CResult_InitFeaturesDecodeErrorZPtr {
4343 err: Box::into_raw(Box::new(e)),
4349 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
4350 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
4351 impl Drop for CResult_InitFeaturesDecodeErrorZ {
4352 fn drop(&mut self) {
4354 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4355 let _ = unsafe { Box::from_raw(self.contents.result) };
4358 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4359 let _ = unsafe { Box::from_raw(self.contents.err) };
4364 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
4365 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4366 let contents = if o.result_ok {
4367 let result = unsafe { o.contents.result };
4368 unsafe { o.contents.result = std::ptr::null_mut() };
4369 CResult_InitFeaturesDecodeErrorZPtr { result }
4371 let err = unsafe { o.contents.err };
4372 unsafe { o.contents.err = std::ptr::null_mut(); }
4373 CResult_InitFeaturesDecodeErrorZPtr { err }
4377 result_ok: o.result_ok,
4382 /// The contents of CResult_NodeFeaturesDecodeErrorZ
4383 pub union CResult_NodeFeaturesDecodeErrorZPtr {
4384 /// A pointer to the contents in the success state.
4385 /// Reading from this pointer when `result_ok` is not set is undefined.
4386 pub result: *mut crate::lightning::ln::features::NodeFeatures,
4387 /// A pointer to the contents in the error state.
4388 /// Reading from this pointer when `result_ok` is set is undefined.
4389 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4392 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4393 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4394 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4395 pub struct CResult_NodeFeaturesDecodeErrorZ {
4396 /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4397 /// `err` or `result` depending on the state of `result_ok`.
4398 pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
4399 /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4400 pub result_ok: bool,
4403 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
4404 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
4405 CResult_NodeFeaturesDecodeErrorZ {
4406 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4407 result: Box::into_raw(Box::new(o)),
4413 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
4414 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
4415 CResult_NodeFeaturesDecodeErrorZ {
4416 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4417 err: Box::into_raw(Box::new(e)),
4423 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
4424 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
4425 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
4426 fn drop(&mut self) {
4428 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4429 let _ = unsafe { Box::from_raw(self.contents.result) };
4432 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4433 let _ = unsafe { Box::from_raw(self.contents.err) };
4438 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
4439 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4440 let contents = if o.result_ok {
4441 let result = unsafe { o.contents.result };
4442 unsafe { o.contents.result = std::ptr::null_mut() };
4443 CResult_NodeFeaturesDecodeErrorZPtr { result }
4445 let err = unsafe { o.contents.err };
4446 unsafe { o.contents.err = std::ptr::null_mut(); }
4447 CResult_NodeFeaturesDecodeErrorZPtr { err }
4451 result_ok: o.result_ok,
4456 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
4457 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
4458 /// A pointer to the contents in the success state.
4459 /// Reading from this pointer when `result_ok` is not set is undefined.
4460 pub result: *mut crate::lightning::ln::features::ChannelFeatures,
4461 /// A pointer to the contents in the error state.
4462 /// Reading from this pointer when `result_ok` is set is undefined.
4463 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4466 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4467 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4468 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4469 pub struct CResult_ChannelFeaturesDecodeErrorZ {
4470 /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4471 /// `err` or `result` depending on the state of `result_ok`.
4472 pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
4473 /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4474 pub result_ok: bool,
4477 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
4478 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
4479 CResult_ChannelFeaturesDecodeErrorZ {
4480 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4481 result: Box::into_raw(Box::new(o)),
4487 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
4488 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
4489 CResult_ChannelFeaturesDecodeErrorZ {
4490 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4491 err: Box::into_raw(Box::new(e)),
4497 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
4498 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
4499 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
4500 fn drop(&mut self) {
4502 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4503 let _ = unsafe { Box::from_raw(self.contents.result) };
4506 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4507 let _ = unsafe { Box::from_raw(self.contents.err) };
4512 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
4513 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4514 let contents = if o.result_ok {
4515 let result = unsafe { o.contents.result };
4516 unsafe { o.contents.result = std::ptr::null_mut() };
4517 CResult_ChannelFeaturesDecodeErrorZPtr { result }
4519 let err = unsafe { o.contents.err };
4520 unsafe { o.contents.err = std::ptr::null_mut(); }
4521 CResult_ChannelFeaturesDecodeErrorZPtr { err }
4525 result_ok: o.result_ok,
4530 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
4531 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
4532 /// A pointer to the contents in the success state.
4533 /// Reading from this pointer when `result_ok` is not set is undefined.
4534 pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
4535 /// A pointer to the contents in the error state.
4536 /// Reading from this pointer when `result_ok` is set is undefined.
4537 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4540 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4541 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4542 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4543 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
4544 /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4545 /// `err` or `result` depending on the state of `result_ok`.
4546 pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
4547 /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4548 pub result_ok: bool,
4551 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
4552 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
4553 CResult_InvoiceFeaturesDecodeErrorZ {
4554 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4555 result: Box::into_raw(Box::new(o)),
4561 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
4562 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
4563 CResult_InvoiceFeaturesDecodeErrorZ {
4564 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4565 err: Box::into_raw(Box::new(e)),
4571 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
4572 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
4573 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
4574 fn drop(&mut self) {
4576 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4577 let _ = unsafe { Box::from_raw(self.contents.result) };
4580 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4581 let _ = unsafe { Box::from_raw(self.contents.err) };
4586 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
4587 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4588 let contents = if o.result_ok {
4589 let result = unsafe { o.contents.result };
4590 unsafe { o.contents.result = std::ptr::null_mut() };
4591 CResult_InvoiceFeaturesDecodeErrorZPtr { result }
4593 let err = unsafe { o.contents.err };
4594 unsafe { o.contents.err = std::ptr::null_mut(); }
4595 CResult_InvoiceFeaturesDecodeErrorZPtr { err }
4599 result_ok: o.result_ok,
4604 /// The contents of CResult_NetAddressu8Z
4605 pub union CResult_NetAddressu8ZPtr {
4606 /// A pointer to the contents in the success state.
4607 /// Reading from this pointer when `result_ok` is not set is undefined.
4608 pub result: *mut crate::lightning::ln::msgs::NetAddress,
4609 /// A pointer to the contents in the error state.
4610 /// Reading from this pointer when `result_ok` is set is undefined.
4614 /// A CResult_NetAddressu8Z represents the result of a fallible operation,
4615 /// containing a crate::lightning::ln::msgs::NetAddress on success and a u8 on failure.
4616 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4617 pub struct CResult_NetAddressu8Z {
4618 /// The contents of this CResult_NetAddressu8Z, accessible via either
4619 /// `err` or `result` depending on the state of `result_ok`.
4620 pub contents: CResult_NetAddressu8ZPtr,
4621 /// Whether this CResult_NetAddressu8Z represents a success state.
4622 pub result_ok: bool,
4625 /// Creates a new CResult_NetAddressu8Z in the success state.
4626 pub extern "C" fn CResult_NetAddressu8Z_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressu8Z {
4627 CResult_NetAddressu8Z {
4628 contents: CResult_NetAddressu8ZPtr {
4629 result: Box::into_raw(Box::new(o)),
4635 /// Creates a new CResult_NetAddressu8Z in the error state.
4636 pub extern "C" fn CResult_NetAddressu8Z_err(e: u8) -> CResult_NetAddressu8Z {
4637 CResult_NetAddressu8Z {
4638 contents: CResult_NetAddressu8ZPtr {
4639 err: Box::into_raw(Box::new(e)),
4645 /// Frees any resources used by the CResult_NetAddressu8Z.
4646 pub extern "C" fn CResult_NetAddressu8Z_free(_res: CResult_NetAddressu8Z) { }
4647 impl Drop for CResult_NetAddressu8Z {
4648 fn drop(&mut self) {
4650 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4651 let _ = unsafe { Box::from_raw(self.contents.result) };
4654 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4655 let _ = unsafe { Box::from_raw(self.contents.err) };
4660 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>> for CResult_NetAddressu8Z {
4661 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>) -> Self {
4662 let contents = if o.result_ok {
4663 let result = unsafe { o.contents.result };
4664 unsafe { o.contents.result = std::ptr::null_mut() };
4665 CResult_NetAddressu8ZPtr { result }
4667 let err = unsafe { o.contents.err };
4668 unsafe { o.contents.err = std::ptr::null_mut(); }
4669 CResult_NetAddressu8ZPtr { err }
4673 result_ok: o.result_ok,
4677 impl Clone for CResult_NetAddressu8Z {
4678 fn clone(&self) -> Self {
4680 Self { result_ok: true, contents: CResult_NetAddressu8ZPtr {
4681 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
4684 Self { result_ok: false, contents: CResult_NetAddressu8ZPtr {
4685 err: Box::into_raw(Box::new(<u8>::clone(unsafe { &*self.contents.err })))
4691 /// Creates a new CResult_NetAddressu8Z which has the same data as `orig`
4692 /// but with all dynamically-allocated buffers duplicated in new buffers.
4693 pub extern "C" fn CResult_NetAddressu8Z_clone(orig: &CResult_NetAddressu8Z) -> CResult_NetAddressu8Z { orig.clone() }
4695 /// The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
4696 pub union CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
4697 /// A pointer to the contents in the success state.
4698 /// Reading from this pointer when `result_ok` is not set is undefined.
4699 pub result: *mut crate::c_types::derived::CResult_NetAddressu8Z,
4700 /// A pointer to the contents in the error state.
4701 /// Reading from this pointer when `result_ok` is set is undefined.
4702 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4705 /// A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
4706 /// containing a crate::c_types::derived::CResult_NetAddressu8Z on success and a crate::lightning::ln::msgs::DecodeError on failure.
4707 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4708 pub struct CResult_CResult_NetAddressu8ZDecodeErrorZ {
4709 /// The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
4710 /// `err` or `result` depending on the state of `result_ok`.
4711 pub contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr,
4712 /// Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
4713 pub result_ok: bool,
4716 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
4717 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o: crate::c_types::derived::CResult_NetAddressu8Z) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
4718 CResult_CResult_NetAddressu8ZDecodeErrorZ {
4719 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
4720 result: Box::into_raw(Box::new(o)),
4726 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
4727 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
4728 CResult_CResult_NetAddressu8ZDecodeErrorZ {
4729 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
4730 err: Box::into_raw(Box::new(e)),
4736 /// Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
4737 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res: CResult_CResult_NetAddressu8ZDecodeErrorZ) { }
4738 impl Drop for CResult_CResult_NetAddressu8ZDecodeErrorZ {
4739 fn drop(&mut self) {
4741 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4742 let _ = unsafe { Box::from_raw(self.contents.result) };
4745 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4746 let _ = unsafe { Box::from_raw(self.contents.err) };
4751 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>> for CResult_CResult_NetAddressu8ZDecodeErrorZ {
4752 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>) -> Self {
4753 let contents = if o.result_ok {
4754 let result = unsafe { o.contents.result };
4755 unsafe { o.contents.result = std::ptr::null_mut() };
4756 CResult_CResult_NetAddressu8ZDecodeErrorZPtr { result }
4758 let err = unsafe { o.contents.err };
4759 unsafe { o.contents.err = std::ptr::null_mut(); }
4760 CResult_CResult_NetAddressu8ZDecodeErrorZPtr { err }
4764 result_ok: o.result_ok,
4768 impl Clone for CResult_CResult_NetAddressu8ZDecodeErrorZ {
4769 fn clone(&self) -> Self {
4771 Self { result_ok: true, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
4772 result: Box::into_raw(Box::new(<crate::c_types::derived::CResult_NetAddressu8Z>::clone(unsafe { &*self.contents.result })))
4775 Self { result_ok: false, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
4776 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4782 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
4783 /// but with all dynamically-allocated buffers duplicated in new buffers.
4784 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig: &CResult_CResult_NetAddressu8ZDecodeErrorZ) -> CResult_CResult_NetAddressu8ZDecodeErrorZ { orig.clone() }
4786 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
4787 /// This corresponds to std::vector in C++
4788 pub struct CVec_UpdateAddHTLCZ {
4789 /// The elements in the array.
4790 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4791 pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
4792 /// The number of elements pointed to by `data`.
4795 impl CVec_UpdateAddHTLCZ {
4796 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
4797 if self.datalen == 0 { return Vec::new(); }
4798 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4799 self.data = std::ptr::null_mut();
4803 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
4804 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4807 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
4808 fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
4809 let datalen = v.len();
4810 let data = Box::into_raw(v.into_boxed_slice());
4811 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4815 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4816 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
4817 impl Drop for CVec_UpdateAddHTLCZ {
4818 fn drop(&mut self) {
4819 if self.datalen == 0 { return; }
4820 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4823 impl Clone for CVec_UpdateAddHTLCZ {
4824 fn clone(&self) -> Self {
4825 let mut res = Vec::new();
4826 if self.datalen == 0 { return Self::from(res); }
4827 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4832 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
4833 /// This corresponds to std::vector in C++
4834 pub struct CVec_UpdateFulfillHTLCZ {
4835 /// The elements in the array.
4836 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4837 pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
4838 /// The number of elements pointed to by `data`.
4841 impl CVec_UpdateFulfillHTLCZ {
4842 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
4843 if self.datalen == 0 { return Vec::new(); }
4844 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4845 self.data = std::ptr::null_mut();
4849 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
4850 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4853 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
4854 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
4855 let datalen = v.len();
4856 let data = Box::into_raw(v.into_boxed_slice());
4857 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4861 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4862 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
4863 impl Drop for CVec_UpdateFulfillHTLCZ {
4864 fn drop(&mut self) {
4865 if self.datalen == 0 { return; }
4866 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4869 impl Clone for CVec_UpdateFulfillHTLCZ {
4870 fn clone(&self) -> Self {
4871 let mut res = Vec::new();
4872 if self.datalen == 0 { return Self::from(res); }
4873 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4878 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
4879 /// This corresponds to std::vector in C++
4880 pub struct CVec_UpdateFailHTLCZ {
4881 /// The elements in the array.
4882 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4883 pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
4884 /// The number of elements pointed to by `data`.
4887 impl CVec_UpdateFailHTLCZ {
4888 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
4889 if self.datalen == 0 { return Vec::new(); }
4890 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4891 self.data = std::ptr::null_mut();
4895 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
4896 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4899 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
4900 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
4901 let datalen = v.len();
4902 let data = Box::into_raw(v.into_boxed_slice());
4903 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4907 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4908 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
4909 impl Drop for CVec_UpdateFailHTLCZ {
4910 fn drop(&mut self) {
4911 if self.datalen == 0 { return; }
4912 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4915 impl Clone for CVec_UpdateFailHTLCZ {
4916 fn clone(&self) -> Self {
4917 let mut res = Vec::new();
4918 if self.datalen == 0 { return Self::from(res); }
4919 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4924 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
4925 /// This corresponds to std::vector in C++
4926 pub struct CVec_UpdateFailMalformedHTLCZ {
4927 /// The elements in the array.
4928 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4929 pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
4930 /// The number of elements pointed to by `data`.
4933 impl CVec_UpdateFailMalformedHTLCZ {
4934 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
4935 if self.datalen == 0 { return Vec::new(); }
4936 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4937 self.data = std::ptr::null_mut();
4941 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
4942 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4945 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
4946 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
4947 let datalen = v.len();
4948 let data = Box::into_raw(v.into_boxed_slice());
4949 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4953 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4954 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
4955 impl Drop for CVec_UpdateFailMalformedHTLCZ {
4956 fn drop(&mut self) {
4957 if self.datalen == 0 { return; }
4958 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4961 impl Clone for CVec_UpdateFailMalformedHTLCZ {
4962 fn clone(&self) -> Self {
4963 let mut res = Vec::new();
4964 if self.datalen == 0 { return Self::from(res); }
4965 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4970 /// The contents of CResult_AcceptChannelDecodeErrorZ
4971 pub union CResult_AcceptChannelDecodeErrorZPtr {
4972 /// A pointer to the contents in the success state.
4973 /// Reading from this pointer when `result_ok` is not set is undefined.
4974 pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
4975 /// A pointer to the contents in the error state.
4976 /// Reading from this pointer when `result_ok` is set is undefined.
4977 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4980 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
4981 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
4982 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4983 pub struct CResult_AcceptChannelDecodeErrorZ {
4984 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
4985 /// `err` or `result` depending on the state of `result_ok`.
4986 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
4987 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
4988 pub result_ok: bool,
4991 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
4992 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
4993 CResult_AcceptChannelDecodeErrorZ {
4994 contents: CResult_AcceptChannelDecodeErrorZPtr {
4995 result: Box::into_raw(Box::new(o)),
5001 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
5002 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
5003 CResult_AcceptChannelDecodeErrorZ {
5004 contents: CResult_AcceptChannelDecodeErrorZPtr {
5005 err: Box::into_raw(Box::new(e)),
5011 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
5012 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
5013 impl Drop for CResult_AcceptChannelDecodeErrorZ {
5014 fn drop(&mut self) {
5016 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5017 let _ = unsafe { Box::from_raw(self.contents.result) };
5020 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5021 let _ = unsafe { Box::from_raw(self.contents.err) };
5026 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
5027 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
5028 let contents = if o.result_ok {
5029 let result = unsafe { o.contents.result };
5030 unsafe { o.contents.result = std::ptr::null_mut() };
5031 CResult_AcceptChannelDecodeErrorZPtr { result }
5033 let err = unsafe { o.contents.err };
5034 unsafe { o.contents.err = std::ptr::null_mut(); }
5035 CResult_AcceptChannelDecodeErrorZPtr { err }
5039 result_ok: o.result_ok,
5043 impl Clone for CResult_AcceptChannelDecodeErrorZ {
5044 fn clone(&self) -> Self {
5046 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
5047 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
5050 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
5051 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5057 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
5058 /// but with all dynamically-allocated buffers duplicated in new buffers.
5059 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { orig.clone() }
5061 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
5062 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
5063 /// A pointer to the contents in the success state.
5064 /// Reading from this pointer when `result_ok` is not set is undefined.
5065 pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
5066 /// A pointer to the contents in the error state.
5067 /// Reading from this pointer when `result_ok` is set is undefined.
5068 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5071 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
5072 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5073 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5074 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
5075 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
5076 /// `err` or `result` depending on the state of `result_ok`.
5077 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
5078 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
5079 pub result_ok: bool,
5082 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
5083 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
5084 CResult_AnnouncementSignaturesDecodeErrorZ {
5085 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
5086 result: Box::into_raw(Box::new(o)),
5092 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
5093 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
5094 CResult_AnnouncementSignaturesDecodeErrorZ {
5095 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
5096 err: Box::into_raw(Box::new(e)),
5102 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
5103 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
5104 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
5105 fn drop(&mut self) {
5107 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5108 let _ = unsafe { Box::from_raw(self.contents.result) };
5111 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5112 let _ = unsafe { Box::from_raw(self.contents.err) };
5117 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
5118 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5119 let contents = if o.result_ok {
5120 let result = unsafe { o.contents.result };
5121 unsafe { o.contents.result = std::ptr::null_mut() };
5122 CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
5124 let err = unsafe { o.contents.err };
5125 unsafe { o.contents.err = std::ptr::null_mut(); }
5126 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
5130 result_ok: o.result_ok,
5134 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
5135 fn clone(&self) -> Self {
5137 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
5138 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
5141 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
5142 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5148 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
5149 /// but with all dynamically-allocated buffers duplicated in new buffers.
5150 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { orig.clone() }
5152 /// The contents of CResult_ChannelReestablishDecodeErrorZ
5153 pub union CResult_ChannelReestablishDecodeErrorZPtr {
5154 /// A pointer to the contents in the success state.
5155 /// Reading from this pointer when `result_ok` is not set is undefined.
5156 pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
5157 /// A pointer to the contents in the error state.
5158 /// Reading from this pointer when `result_ok` is set is undefined.
5159 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5162 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
5163 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
5164 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5165 pub struct CResult_ChannelReestablishDecodeErrorZ {
5166 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
5167 /// `err` or `result` depending on the state of `result_ok`.
5168 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
5169 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
5170 pub result_ok: bool,
5173 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
5174 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
5175 CResult_ChannelReestablishDecodeErrorZ {
5176 contents: CResult_ChannelReestablishDecodeErrorZPtr {
5177 result: Box::into_raw(Box::new(o)),
5183 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
5184 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
5185 CResult_ChannelReestablishDecodeErrorZ {
5186 contents: CResult_ChannelReestablishDecodeErrorZPtr {
5187 err: Box::into_raw(Box::new(e)),
5193 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
5194 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
5195 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
5196 fn drop(&mut self) {
5198 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5199 let _ = unsafe { Box::from_raw(self.contents.result) };
5202 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5203 let _ = unsafe { Box::from_raw(self.contents.err) };
5208 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
5209 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
5210 let contents = if o.result_ok {
5211 let result = unsafe { o.contents.result };
5212 unsafe { o.contents.result = std::ptr::null_mut() };
5213 CResult_ChannelReestablishDecodeErrorZPtr { result }
5215 let err = unsafe { o.contents.err };
5216 unsafe { o.contents.err = std::ptr::null_mut(); }
5217 CResult_ChannelReestablishDecodeErrorZPtr { err }
5221 result_ok: o.result_ok,
5225 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
5226 fn clone(&self) -> Self {
5228 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
5229 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
5232 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
5233 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5239 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
5240 /// but with all dynamically-allocated buffers duplicated in new buffers.
5241 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { orig.clone() }
5243 /// The contents of CResult_ClosingSignedDecodeErrorZ
5244 pub union CResult_ClosingSignedDecodeErrorZPtr {
5245 /// A pointer to the contents in the success state.
5246 /// Reading from this pointer when `result_ok` is not set is undefined.
5247 pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
5248 /// A pointer to the contents in the error state.
5249 /// Reading from this pointer when `result_ok` is set is undefined.
5250 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5253 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
5254 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
5255 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5256 pub struct CResult_ClosingSignedDecodeErrorZ {
5257 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
5258 /// `err` or `result` depending on the state of `result_ok`.
5259 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
5260 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
5261 pub result_ok: bool,
5264 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
5265 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
5266 CResult_ClosingSignedDecodeErrorZ {
5267 contents: CResult_ClosingSignedDecodeErrorZPtr {
5268 result: Box::into_raw(Box::new(o)),
5274 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
5275 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
5276 CResult_ClosingSignedDecodeErrorZ {
5277 contents: CResult_ClosingSignedDecodeErrorZPtr {
5278 err: Box::into_raw(Box::new(e)),
5284 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
5285 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
5286 impl Drop for CResult_ClosingSignedDecodeErrorZ {
5287 fn drop(&mut self) {
5289 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5290 let _ = unsafe { Box::from_raw(self.contents.result) };
5293 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5294 let _ = unsafe { Box::from_raw(self.contents.err) };
5299 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
5300 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
5301 let contents = if o.result_ok {
5302 let result = unsafe { o.contents.result };
5303 unsafe { o.contents.result = std::ptr::null_mut() };
5304 CResult_ClosingSignedDecodeErrorZPtr { result }
5306 let err = unsafe { o.contents.err };
5307 unsafe { o.contents.err = std::ptr::null_mut(); }
5308 CResult_ClosingSignedDecodeErrorZPtr { err }
5312 result_ok: o.result_ok,
5316 impl Clone for CResult_ClosingSignedDecodeErrorZ {
5317 fn clone(&self) -> Self {
5319 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
5320 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
5323 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
5324 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5330 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
5331 /// but with all dynamically-allocated buffers duplicated in new buffers.
5332 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { orig.clone() }
5334 /// The contents of CResult_CommitmentSignedDecodeErrorZ
5335 pub union CResult_CommitmentSignedDecodeErrorZPtr {
5336 /// A pointer to the contents in the success state.
5337 /// Reading from this pointer when `result_ok` is not set is undefined.
5338 pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
5339 /// A pointer to the contents in the error state.
5340 /// Reading from this pointer when `result_ok` is set is undefined.
5341 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5344 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
5345 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
5346 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5347 pub struct CResult_CommitmentSignedDecodeErrorZ {
5348 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
5349 /// `err` or `result` depending on the state of `result_ok`.
5350 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
5351 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
5352 pub result_ok: bool,
5355 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
5356 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
5357 CResult_CommitmentSignedDecodeErrorZ {
5358 contents: CResult_CommitmentSignedDecodeErrorZPtr {
5359 result: Box::into_raw(Box::new(o)),
5365 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
5366 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
5367 CResult_CommitmentSignedDecodeErrorZ {
5368 contents: CResult_CommitmentSignedDecodeErrorZPtr {
5369 err: Box::into_raw(Box::new(e)),
5375 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
5376 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
5377 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
5378 fn drop(&mut self) {
5380 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5381 let _ = unsafe { Box::from_raw(self.contents.result) };
5384 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5385 let _ = unsafe { Box::from_raw(self.contents.err) };
5390 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
5391 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
5392 let contents = if o.result_ok {
5393 let result = unsafe { o.contents.result };
5394 unsafe { o.contents.result = std::ptr::null_mut() };
5395 CResult_CommitmentSignedDecodeErrorZPtr { result }
5397 let err = unsafe { o.contents.err };
5398 unsafe { o.contents.err = std::ptr::null_mut(); }
5399 CResult_CommitmentSignedDecodeErrorZPtr { err }
5403 result_ok: o.result_ok,
5407 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
5408 fn clone(&self) -> Self {
5410 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
5411 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
5414 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
5415 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5421 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
5422 /// but with all dynamically-allocated buffers duplicated in new buffers.
5423 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { orig.clone() }
5425 /// The contents of CResult_FundingCreatedDecodeErrorZ
5426 pub union CResult_FundingCreatedDecodeErrorZPtr {
5427 /// A pointer to the contents in the success state.
5428 /// Reading from this pointer when `result_ok` is not set is undefined.
5429 pub result: *mut crate::lightning::ln::msgs::FundingCreated,
5430 /// A pointer to the contents in the error state.
5431 /// Reading from this pointer when `result_ok` is set is undefined.
5432 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5435 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
5436 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
5437 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5438 pub struct CResult_FundingCreatedDecodeErrorZ {
5439 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
5440 /// `err` or `result` depending on the state of `result_ok`.
5441 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
5442 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
5443 pub result_ok: bool,
5446 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
5447 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
5448 CResult_FundingCreatedDecodeErrorZ {
5449 contents: CResult_FundingCreatedDecodeErrorZPtr {
5450 result: Box::into_raw(Box::new(o)),
5456 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
5457 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
5458 CResult_FundingCreatedDecodeErrorZ {
5459 contents: CResult_FundingCreatedDecodeErrorZPtr {
5460 err: Box::into_raw(Box::new(e)),
5466 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
5467 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
5468 impl Drop for CResult_FundingCreatedDecodeErrorZ {
5469 fn drop(&mut self) {
5471 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5472 let _ = unsafe { Box::from_raw(self.contents.result) };
5475 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5476 let _ = unsafe { Box::from_raw(self.contents.err) };
5481 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
5482 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
5483 let contents = if o.result_ok {
5484 let result = unsafe { o.contents.result };
5485 unsafe { o.contents.result = std::ptr::null_mut() };
5486 CResult_FundingCreatedDecodeErrorZPtr { result }
5488 let err = unsafe { o.contents.err };
5489 unsafe { o.contents.err = std::ptr::null_mut(); }
5490 CResult_FundingCreatedDecodeErrorZPtr { err }
5494 result_ok: o.result_ok,
5498 impl Clone for CResult_FundingCreatedDecodeErrorZ {
5499 fn clone(&self) -> Self {
5501 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
5502 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
5505 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
5506 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5512 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
5513 /// but with all dynamically-allocated buffers duplicated in new buffers.
5514 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { orig.clone() }
5516 /// The contents of CResult_FundingSignedDecodeErrorZ
5517 pub union CResult_FundingSignedDecodeErrorZPtr {
5518 /// A pointer to the contents in the success state.
5519 /// Reading from this pointer when `result_ok` is not set is undefined.
5520 pub result: *mut crate::lightning::ln::msgs::FundingSigned,
5521 /// A pointer to the contents in the error state.
5522 /// Reading from this pointer when `result_ok` is set is undefined.
5523 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5526 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
5527 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
5528 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5529 pub struct CResult_FundingSignedDecodeErrorZ {
5530 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
5531 /// `err` or `result` depending on the state of `result_ok`.
5532 pub contents: CResult_FundingSignedDecodeErrorZPtr,
5533 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
5534 pub result_ok: bool,
5537 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
5538 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
5539 CResult_FundingSignedDecodeErrorZ {
5540 contents: CResult_FundingSignedDecodeErrorZPtr {
5541 result: Box::into_raw(Box::new(o)),
5547 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
5548 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
5549 CResult_FundingSignedDecodeErrorZ {
5550 contents: CResult_FundingSignedDecodeErrorZPtr {
5551 err: Box::into_raw(Box::new(e)),
5557 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
5558 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
5559 impl Drop for CResult_FundingSignedDecodeErrorZ {
5560 fn drop(&mut self) {
5562 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5563 let _ = unsafe { Box::from_raw(self.contents.result) };
5566 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5567 let _ = unsafe { Box::from_raw(self.contents.err) };
5572 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
5573 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
5574 let contents = if o.result_ok {
5575 let result = unsafe { o.contents.result };
5576 unsafe { o.contents.result = std::ptr::null_mut() };
5577 CResult_FundingSignedDecodeErrorZPtr { result }
5579 let err = unsafe { o.contents.err };
5580 unsafe { o.contents.err = std::ptr::null_mut(); }
5581 CResult_FundingSignedDecodeErrorZPtr { err }
5585 result_ok: o.result_ok,
5589 impl Clone for CResult_FundingSignedDecodeErrorZ {
5590 fn clone(&self) -> Self {
5592 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
5593 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
5596 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
5597 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5603 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
5604 /// but with all dynamically-allocated buffers duplicated in new buffers.
5605 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { orig.clone() }
5607 /// The contents of CResult_FundingLockedDecodeErrorZ
5608 pub union CResult_FundingLockedDecodeErrorZPtr {
5609 /// A pointer to the contents in the success state.
5610 /// Reading from this pointer when `result_ok` is not set is undefined.
5611 pub result: *mut crate::lightning::ln::msgs::FundingLocked,
5612 /// A pointer to the contents in the error state.
5613 /// Reading from this pointer when `result_ok` is set is undefined.
5614 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5617 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
5618 /// containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
5619 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5620 pub struct CResult_FundingLockedDecodeErrorZ {
5621 /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
5622 /// `err` or `result` depending on the state of `result_ok`.
5623 pub contents: CResult_FundingLockedDecodeErrorZPtr,
5624 /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
5625 pub result_ok: bool,
5628 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
5629 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
5630 CResult_FundingLockedDecodeErrorZ {
5631 contents: CResult_FundingLockedDecodeErrorZPtr {
5632 result: Box::into_raw(Box::new(o)),
5638 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
5639 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
5640 CResult_FundingLockedDecodeErrorZ {
5641 contents: CResult_FundingLockedDecodeErrorZPtr {
5642 err: Box::into_raw(Box::new(e)),
5648 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
5649 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
5650 impl Drop for CResult_FundingLockedDecodeErrorZ {
5651 fn drop(&mut self) {
5653 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5654 let _ = unsafe { Box::from_raw(self.contents.result) };
5657 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5658 let _ = unsafe { Box::from_raw(self.contents.err) };
5663 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
5664 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
5665 let contents = if o.result_ok {
5666 let result = unsafe { o.contents.result };
5667 unsafe { o.contents.result = std::ptr::null_mut() };
5668 CResult_FundingLockedDecodeErrorZPtr { result }
5670 let err = unsafe { o.contents.err };
5671 unsafe { o.contents.err = std::ptr::null_mut(); }
5672 CResult_FundingLockedDecodeErrorZPtr { err }
5676 result_ok: o.result_ok,
5680 impl Clone for CResult_FundingLockedDecodeErrorZ {
5681 fn clone(&self) -> Self {
5683 Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
5684 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
5687 Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
5688 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5694 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
5695 /// but with all dynamically-allocated buffers duplicated in new buffers.
5696 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { orig.clone() }
5698 /// The contents of CResult_InitDecodeErrorZ
5699 pub union CResult_InitDecodeErrorZPtr {
5700 /// A pointer to the contents in the success state.
5701 /// Reading from this pointer when `result_ok` is not set is undefined.
5702 pub result: *mut crate::lightning::ln::msgs::Init,
5703 /// A pointer to the contents in the error state.
5704 /// Reading from this pointer when `result_ok` is set is undefined.
5705 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5708 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
5709 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
5710 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5711 pub struct CResult_InitDecodeErrorZ {
5712 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
5713 /// `err` or `result` depending on the state of `result_ok`.
5714 pub contents: CResult_InitDecodeErrorZPtr,
5715 /// Whether this CResult_InitDecodeErrorZ represents a success state.
5716 pub result_ok: bool,
5719 /// Creates a new CResult_InitDecodeErrorZ in the success state.
5720 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
5721 CResult_InitDecodeErrorZ {
5722 contents: CResult_InitDecodeErrorZPtr {
5723 result: Box::into_raw(Box::new(o)),
5729 /// Creates a new CResult_InitDecodeErrorZ in the error state.
5730 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
5731 CResult_InitDecodeErrorZ {
5732 contents: CResult_InitDecodeErrorZPtr {
5733 err: Box::into_raw(Box::new(e)),
5739 /// Frees any resources used by the CResult_InitDecodeErrorZ.
5740 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
5741 impl Drop for CResult_InitDecodeErrorZ {
5742 fn drop(&mut self) {
5744 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5745 let _ = unsafe { Box::from_raw(self.contents.result) };
5748 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5749 let _ = unsafe { Box::from_raw(self.contents.err) };
5754 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
5755 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
5756 let contents = if o.result_ok {
5757 let result = unsafe { o.contents.result };
5758 unsafe { o.contents.result = std::ptr::null_mut() };
5759 CResult_InitDecodeErrorZPtr { result }
5761 let err = unsafe { o.contents.err };
5762 unsafe { o.contents.err = std::ptr::null_mut(); }
5763 CResult_InitDecodeErrorZPtr { err }
5767 result_ok: o.result_ok,
5771 impl Clone for CResult_InitDecodeErrorZ {
5772 fn clone(&self) -> Self {
5774 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
5775 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
5778 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
5779 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5785 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
5786 /// but with all dynamically-allocated buffers duplicated in new buffers.
5787 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { orig.clone() }
5789 /// The contents of CResult_OpenChannelDecodeErrorZ
5790 pub union CResult_OpenChannelDecodeErrorZPtr {
5791 /// A pointer to the contents in the success state.
5792 /// Reading from this pointer when `result_ok` is not set is undefined.
5793 pub result: *mut crate::lightning::ln::msgs::OpenChannel,
5794 /// A pointer to the contents in the error state.
5795 /// Reading from this pointer when `result_ok` is set is undefined.
5796 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5799 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
5800 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
5801 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5802 pub struct CResult_OpenChannelDecodeErrorZ {
5803 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
5804 /// `err` or `result` depending on the state of `result_ok`.
5805 pub contents: CResult_OpenChannelDecodeErrorZPtr,
5806 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
5807 pub result_ok: bool,
5810 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
5811 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
5812 CResult_OpenChannelDecodeErrorZ {
5813 contents: CResult_OpenChannelDecodeErrorZPtr {
5814 result: Box::into_raw(Box::new(o)),
5820 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
5821 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
5822 CResult_OpenChannelDecodeErrorZ {
5823 contents: CResult_OpenChannelDecodeErrorZPtr {
5824 err: Box::into_raw(Box::new(e)),
5830 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
5831 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
5832 impl Drop for CResult_OpenChannelDecodeErrorZ {
5833 fn drop(&mut self) {
5835 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5836 let _ = unsafe { Box::from_raw(self.contents.result) };
5839 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5840 let _ = unsafe { Box::from_raw(self.contents.err) };
5845 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
5846 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
5847 let contents = if o.result_ok {
5848 let result = unsafe { o.contents.result };
5849 unsafe { o.contents.result = std::ptr::null_mut() };
5850 CResult_OpenChannelDecodeErrorZPtr { result }
5852 let err = unsafe { o.contents.err };
5853 unsafe { o.contents.err = std::ptr::null_mut(); }
5854 CResult_OpenChannelDecodeErrorZPtr { err }
5858 result_ok: o.result_ok,
5862 impl Clone for CResult_OpenChannelDecodeErrorZ {
5863 fn clone(&self) -> Self {
5865 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
5866 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
5869 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
5870 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5876 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
5877 /// but with all dynamically-allocated buffers duplicated in new buffers.
5878 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { orig.clone() }
5880 /// The contents of CResult_RevokeAndACKDecodeErrorZ
5881 pub union CResult_RevokeAndACKDecodeErrorZPtr {
5882 /// A pointer to the contents in the success state.
5883 /// Reading from this pointer when `result_ok` is not set is undefined.
5884 pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
5885 /// A pointer to the contents in the error state.
5886 /// Reading from this pointer when `result_ok` is set is undefined.
5887 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5890 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
5891 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
5892 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5893 pub struct CResult_RevokeAndACKDecodeErrorZ {
5894 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
5895 /// `err` or `result` depending on the state of `result_ok`.
5896 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
5897 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
5898 pub result_ok: bool,
5901 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
5902 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
5903 CResult_RevokeAndACKDecodeErrorZ {
5904 contents: CResult_RevokeAndACKDecodeErrorZPtr {
5905 result: Box::into_raw(Box::new(o)),
5911 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
5912 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
5913 CResult_RevokeAndACKDecodeErrorZ {
5914 contents: CResult_RevokeAndACKDecodeErrorZPtr {
5915 err: Box::into_raw(Box::new(e)),
5921 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
5922 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
5923 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
5924 fn drop(&mut self) {
5926 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5927 let _ = unsafe { Box::from_raw(self.contents.result) };
5930 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5931 let _ = unsafe { Box::from_raw(self.contents.err) };
5936 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
5937 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
5938 let contents = if o.result_ok {
5939 let result = unsafe { o.contents.result };
5940 unsafe { o.contents.result = std::ptr::null_mut() };
5941 CResult_RevokeAndACKDecodeErrorZPtr { result }
5943 let err = unsafe { o.contents.err };
5944 unsafe { o.contents.err = std::ptr::null_mut(); }
5945 CResult_RevokeAndACKDecodeErrorZPtr { err }
5949 result_ok: o.result_ok,
5953 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
5954 fn clone(&self) -> Self {
5956 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
5957 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
5960 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
5961 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5967 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
5968 /// but with all dynamically-allocated buffers duplicated in new buffers.
5969 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { orig.clone() }
5971 /// The contents of CResult_ShutdownDecodeErrorZ
5972 pub union CResult_ShutdownDecodeErrorZPtr {
5973 /// A pointer to the contents in the success state.
5974 /// Reading from this pointer when `result_ok` is not set is undefined.
5975 pub result: *mut crate::lightning::ln::msgs::Shutdown,
5976 /// A pointer to the contents in the error state.
5977 /// Reading from this pointer when `result_ok` is set is undefined.
5978 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5981 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
5982 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
5983 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5984 pub struct CResult_ShutdownDecodeErrorZ {
5985 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
5986 /// `err` or `result` depending on the state of `result_ok`.
5987 pub contents: CResult_ShutdownDecodeErrorZPtr,
5988 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
5989 pub result_ok: bool,
5992 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
5993 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
5994 CResult_ShutdownDecodeErrorZ {
5995 contents: CResult_ShutdownDecodeErrorZPtr {
5996 result: Box::into_raw(Box::new(o)),
6002 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
6003 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
6004 CResult_ShutdownDecodeErrorZ {
6005 contents: CResult_ShutdownDecodeErrorZPtr {
6006 err: Box::into_raw(Box::new(e)),
6012 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
6013 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
6014 impl Drop for CResult_ShutdownDecodeErrorZ {
6015 fn drop(&mut self) {
6017 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6018 let _ = unsafe { Box::from_raw(self.contents.result) };
6021 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6022 let _ = unsafe { Box::from_raw(self.contents.err) };
6027 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
6028 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
6029 let contents = if o.result_ok {
6030 let result = unsafe { o.contents.result };
6031 unsafe { o.contents.result = std::ptr::null_mut() };
6032 CResult_ShutdownDecodeErrorZPtr { result }
6034 let err = unsafe { o.contents.err };
6035 unsafe { o.contents.err = std::ptr::null_mut(); }
6036 CResult_ShutdownDecodeErrorZPtr { err }
6040 result_ok: o.result_ok,
6044 impl Clone for CResult_ShutdownDecodeErrorZ {
6045 fn clone(&self) -> Self {
6047 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
6048 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
6051 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
6052 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6058 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
6059 /// but with all dynamically-allocated buffers duplicated in new buffers.
6060 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { orig.clone() }
6062 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
6063 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
6064 /// A pointer to the contents in the success state.
6065 /// Reading from this pointer when `result_ok` is not set is undefined.
6066 pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
6067 /// A pointer to the contents in the error state.
6068 /// Reading from this pointer when `result_ok` is set is undefined.
6069 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6072 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
6073 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
6074 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6075 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
6076 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
6077 /// `err` or `result` depending on the state of `result_ok`.
6078 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
6079 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
6080 pub result_ok: bool,
6083 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
6084 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
6085 CResult_UpdateFailHTLCDecodeErrorZ {
6086 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
6087 result: Box::into_raw(Box::new(o)),
6093 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
6094 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
6095 CResult_UpdateFailHTLCDecodeErrorZ {
6096 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
6097 err: Box::into_raw(Box::new(e)),
6103 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
6104 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
6105 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
6106 fn drop(&mut self) {
6108 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6109 let _ = unsafe { Box::from_raw(self.contents.result) };
6112 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6113 let _ = unsafe { Box::from_raw(self.contents.err) };
6118 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
6119 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
6120 let contents = if o.result_ok {
6121 let result = unsafe { o.contents.result };
6122 unsafe { o.contents.result = std::ptr::null_mut() };
6123 CResult_UpdateFailHTLCDecodeErrorZPtr { result }
6125 let err = unsafe { o.contents.err };
6126 unsafe { o.contents.err = std::ptr::null_mut(); }
6127 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
6131 result_ok: o.result_ok,
6135 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
6136 fn clone(&self) -> Self {
6138 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
6139 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
6142 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
6143 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6149 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
6150 /// but with all dynamically-allocated buffers duplicated in new buffers.
6151 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { orig.clone() }
6153 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
6154 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
6155 /// A pointer to the contents in the success state.
6156 /// Reading from this pointer when `result_ok` is not set is undefined.
6157 pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
6158 /// A pointer to the contents in the error state.
6159 /// Reading from this pointer when `result_ok` is set is undefined.
6160 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6163 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
6164 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
6165 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6166 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
6167 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
6168 /// `err` or `result` depending on the state of `result_ok`.
6169 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
6170 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
6171 pub result_ok: bool,
6174 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
6175 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
6176 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
6177 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
6178 result: Box::into_raw(Box::new(o)),
6184 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
6185 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
6186 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
6187 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
6188 err: Box::into_raw(Box::new(e)),
6194 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
6195 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
6196 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
6197 fn drop(&mut self) {
6199 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6200 let _ = unsafe { Box::from_raw(self.contents.result) };
6203 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6204 let _ = unsafe { Box::from_raw(self.contents.err) };
6209 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
6210 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
6211 let contents = if o.result_ok {
6212 let result = unsafe { o.contents.result };
6213 unsafe { o.contents.result = std::ptr::null_mut() };
6214 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
6216 let err = unsafe { o.contents.err };
6217 unsafe { o.contents.err = std::ptr::null_mut(); }
6218 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
6222 result_ok: o.result_ok,
6226 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
6227 fn clone(&self) -> Self {
6229 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
6230 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
6233 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
6234 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6240 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
6241 /// but with all dynamically-allocated buffers duplicated in new buffers.
6242 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { orig.clone() }
6244 /// The contents of CResult_UpdateFeeDecodeErrorZ
6245 pub union CResult_UpdateFeeDecodeErrorZPtr {
6246 /// A pointer to the contents in the success state.
6247 /// Reading from this pointer when `result_ok` is not set is undefined.
6248 pub result: *mut crate::lightning::ln::msgs::UpdateFee,
6249 /// A pointer to the contents in the error state.
6250 /// Reading from this pointer when `result_ok` is set is undefined.
6251 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6254 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
6255 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
6256 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6257 pub struct CResult_UpdateFeeDecodeErrorZ {
6258 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
6259 /// `err` or `result` depending on the state of `result_ok`.
6260 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
6261 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
6262 pub result_ok: bool,
6265 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
6266 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
6267 CResult_UpdateFeeDecodeErrorZ {
6268 contents: CResult_UpdateFeeDecodeErrorZPtr {
6269 result: Box::into_raw(Box::new(o)),
6275 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
6276 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
6277 CResult_UpdateFeeDecodeErrorZ {
6278 contents: CResult_UpdateFeeDecodeErrorZPtr {
6279 err: Box::into_raw(Box::new(e)),
6285 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
6286 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
6287 impl Drop for CResult_UpdateFeeDecodeErrorZ {
6288 fn drop(&mut self) {
6290 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6291 let _ = unsafe { Box::from_raw(self.contents.result) };
6294 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6295 let _ = unsafe { Box::from_raw(self.contents.err) };
6300 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
6301 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
6302 let contents = if o.result_ok {
6303 let result = unsafe { o.contents.result };
6304 unsafe { o.contents.result = std::ptr::null_mut() };
6305 CResult_UpdateFeeDecodeErrorZPtr { result }
6307 let err = unsafe { o.contents.err };
6308 unsafe { o.contents.err = std::ptr::null_mut(); }
6309 CResult_UpdateFeeDecodeErrorZPtr { err }
6313 result_ok: o.result_ok,
6317 impl Clone for CResult_UpdateFeeDecodeErrorZ {
6318 fn clone(&self) -> Self {
6320 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
6321 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
6324 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
6325 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6331 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
6332 /// but with all dynamically-allocated buffers duplicated in new buffers.
6333 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { orig.clone() }
6335 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
6336 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
6337 /// A pointer to the contents in the success state.
6338 /// Reading from this pointer when `result_ok` is not set is undefined.
6339 pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
6340 /// A pointer to the contents in the error state.
6341 /// Reading from this pointer when `result_ok` is set is undefined.
6342 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6345 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
6346 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
6347 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6348 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
6349 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
6350 /// `err` or `result` depending on the state of `result_ok`.
6351 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
6352 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
6353 pub result_ok: bool,
6356 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
6357 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
6358 CResult_UpdateFulfillHTLCDecodeErrorZ {
6359 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
6360 result: Box::into_raw(Box::new(o)),
6366 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
6367 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
6368 CResult_UpdateFulfillHTLCDecodeErrorZ {
6369 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
6370 err: Box::into_raw(Box::new(e)),
6376 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
6377 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
6378 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
6379 fn drop(&mut self) {
6381 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6382 let _ = unsafe { Box::from_raw(self.contents.result) };
6385 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6386 let _ = unsafe { Box::from_raw(self.contents.err) };
6391 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
6392 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
6393 let contents = if o.result_ok {
6394 let result = unsafe { o.contents.result };
6395 unsafe { o.contents.result = std::ptr::null_mut() };
6396 CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
6398 let err = unsafe { o.contents.err };
6399 unsafe { o.contents.err = std::ptr::null_mut(); }
6400 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
6404 result_ok: o.result_ok,
6408 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
6409 fn clone(&self) -> Self {
6411 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
6412 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
6415 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
6416 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6422 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
6423 /// but with all dynamically-allocated buffers duplicated in new buffers.
6424 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { orig.clone() }
6426 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
6427 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
6428 /// A pointer to the contents in the success state.
6429 /// Reading from this pointer when `result_ok` is not set is undefined.
6430 pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
6431 /// A pointer to the contents in the error state.
6432 /// Reading from this pointer when `result_ok` is set is undefined.
6433 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6436 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
6437 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
6438 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6439 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
6440 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
6441 /// `err` or `result` depending on the state of `result_ok`.
6442 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
6443 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
6444 pub result_ok: bool,
6447 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
6448 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
6449 CResult_UpdateAddHTLCDecodeErrorZ {
6450 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
6451 result: Box::into_raw(Box::new(o)),
6457 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
6458 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
6459 CResult_UpdateAddHTLCDecodeErrorZ {
6460 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
6461 err: Box::into_raw(Box::new(e)),
6467 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
6468 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
6469 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
6470 fn drop(&mut self) {
6472 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6473 let _ = unsafe { Box::from_raw(self.contents.result) };
6476 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6477 let _ = unsafe { Box::from_raw(self.contents.err) };
6482 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
6483 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
6484 let contents = if o.result_ok {
6485 let result = unsafe { o.contents.result };
6486 unsafe { o.contents.result = std::ptr::null_mut() };
6487 CResult_UpdateAddHTLCDecodeErrorZPtr { result }
6489 let err = unsafe { o.contents.err };
6490 unsafe { o.contents.err = std::ptr::null_mut(); }
6491 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
6495 result_ok: o.result_ok,
6499 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
6500 fn clone(&self) -> Self {
6502 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
6503 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
6506 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
6507 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6513 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
6514 /// but with all dynamically-allocated buffers duplicated in new buffers.
6515 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { orig.clone() }
6517 /// The contents of CResult_PingDecodeErrorZ
6518 pub union CResult_PingDecodeErrorZPtr {
6519 /// A pointer to the contents in the success state.
6520 /// Reading from this pointer when `result_ok` is not set is undefined.
6521 pub result: *mut crate::lightning::ln::msgs::Ping,
6522 /// A pointer to the contents in the error state.
6523 /// Reading from this pointer when `result_ok` is set is undefined.
6524 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6527 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
6528 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
6529 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6530 pub struct CResult_PingDecodeErrorZ {
6531 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
6532 /// `err` or `result` depending on the state of `result_ok`.
6533 pub contents: CResult_PingDecodeErrorZPtr,
6534 /// Whether this CResult_PingDecodeErrorZ represents a success state.
6535 pub result_ok: bool,
6538 /// Creates a new CResult_PingDecodeErrorZ in the success state.
6539 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
6540 CResult_PingDecodeErrorZ {
6541 contents: CResult_PingDecodeErrorZPtr {
6542 result: Box::into_raw(Box::new(o)),
6548 /// Creates a new CResult_PingDecodeErrorZ in the error state.
6549 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
6550 CResult_PingDecodeErrorZ {
6551 contents: CResult_PingDecodeErrorZPtr {
6552 err: Box::into_raw(Box::new(e)),
6558 /// Frees any resources used by the CResult_PingDecodeErrorZ.
6559 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
6560 impl Drop for CResult_PingDecodeErrorZ {
6561 fn drop(&mut self) {
6563 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6564 let _ = unsafe { Box::from_raw(self.contents.result) };
6567 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6568 let _ = unsafe { Box::from_raw(self.contents.err) };
6573 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
6574 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
6575 let contents = if o.result_ok {
6576 let result = unsafe { o.contents.result };
6577 unsafe { o.contents.result = std::ptr::null_mut() };
6578 CResult_PingDecodeErrorZPtr { result }
6580 let err = unsafe { o.contents.err };
6581 unsafe { o.contents.err = std::ptr::null_mut(); }
6582 CResult_PingDecodeErrorZPtr { err }
6586 result_ok: o.result_ok,
6590 impl Clone for CResult_PingDecodeErrorZ {
6591 fn clone(&self) -> Self {
6593 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
6594 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
6597 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
6598 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6604 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
6605 /// but with all dynamically-allocated buffers duplicated in new buffers.
6606 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { orig.clone() }
6608 /// The contents of CResult_PongDecodeErrorZ
6609 pub union CResult_PongDecodeErrorZPtr {
6610 /// A pointer to the contents in the success state.
6611 /// Reading from this pointer when `result_ok` is not set is undefined.
6612 pub result: *mut crate::lightning::ln::msgs::Pong,
6613 /// A pointer to the contents in the error state.
6614 /// Reading from this pointer when `result_ok` is set is undefined.
6615 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6618 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
6619 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
6620 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6621 pub struct CResult_PongDecodeErrorZ {
6622 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
6623 /// `err` or `result` depending on the state of `result_ok`.
6624 pub contents: CResult_PongDecodeErrorZPtr,
6625 /// Whether this CResult_PongDecodeErrorZ represents a success state.
6626 pub result_ok: bool,
6629 /// Creates a new CResult_PongDecodeErrorZ in the success state.
6630 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
6631 CResult_PongDecodeErrorZ {
6632 contents: CResult_PongDecodeErrorZPtr {
6633 result: Box::into_raw(Box::new(o)),
6639 /// Creates a new CResult_PongDecodeErrorZ in the error state.
6640 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
6641 CResult_PongDecodeErrorZ {
6642 contents: CResult_PongDecodeErrorZPtr {
6643 err: Box::into_raw(Box::new(e)),
6649 /// Frees any resources used by the CResult_PongDecodeErrorZ.
6650 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
6651 impl Drop for CResult_PongDecodeErrorZ {
6652 fn drop(&mut self) {
6654 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6655 let _ = unsafe { Box::from_raw(self.contents.result) };
6658 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6659 let _ = unsafe { Box::from_raw(self.contents.err) };
6664 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
6665 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
6666 let contents = if o.result_ok {
6667 let result = unsafe { o.contents.result };
6668 unsafe { o.contents.result = std::ptr::null_mut() };
6669 CResult_PongDecodeErrorZPtr { result }
6671 let err = unsafe { o.contents.err };
6672 unsafe { o.contents.err = std::ptr::null_mut(); }
6673 CResult_PongDecodeErrorZPtr { err }
6677 result_ok: o.result_ok,
6681 impl Clone for CResult_PongDecodeErrorZ {
6682 fn clone(&self) -> Self {
6684 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
6685 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
6688 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
6689 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6695 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
6696 /// but with all dynamically-allocated buffers duplicated in new buffers.
6697 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { orig.clone() }
6699 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
6700 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
6701 /// A pointer to the contents in the success state.
6702 /// Reading from this pointer when `result_ok` is not set is undefined.
6703 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
6704 /// A pointer to the contents in the error state.
6705 /// Reading from this pointer when `result_ok` is set is undefined.
6706 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6709 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
6710 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
6711 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6712 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
6713 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
6714 /// `err` or `result` depending on the state of `result_ok`.
6715 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
6716 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
6717 pub result_ok: bool,
6720 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
6721 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
6722 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
6723 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
6724 result: Box::into_raw(Box::new(o)),
6730 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
6731 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
6732 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
6733 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
6734 err: Box::into_raw(Box::new(e)),
6740 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
6741 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
6742 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
6743 fn drop(&mut self) {
6745 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6746 let _ = unsafe { Box::from_raw(self.contents.result) };
6749 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6750 let _ = unsafe { Box::from_raw(self.contents.err) };
6755 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
6756 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
6757 let contents = if o.result_ok {
6758 let result = unsafe { o.contents.result };
6759 unsafe { o.contents.result = std::ptr::null_mut() };
6760 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
6762 let err = unsafe { o.contents.err };
6763 unsafe { o.contents.err = std::ptr::null_mut(); }
6764 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
6768 result_ok: o.result_ok,
6772 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
6773 fn clone(&self) -> Self {
6775 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
6776 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
6779 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
6780 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6786 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
6787 /// but with all dynamically-allocated buffers duplicated in new buffers.
6788 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { orig.clone() }
6790 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
6791 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
6792 /// A pointer to the contents in the success state.
6793 /// Reading from this pointer when `result_ok` is not set is undefined.
6794 pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
6795 /// A pointer to the contents in the error state.
6796 /// Reading from this pointer when `result_ok` is set is undefined.
6797 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6800 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
6801 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
6802 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6803 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
6804 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
6805 /// `err` or `result` depending on the state of `result_ok`.
6806 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
6807 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
6808 pub result_ok: bool,
6811 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
6812 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
6813 CResult_ChannelAnnouncementDecodeErrorZ {
6814 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
6815 result: Box::into_raw(Box::new(o)),
6821 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
6822 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
6823 CResult_ChannelAnnouncementDecodeErrorZ {
6824 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
6825 err: Box::into_raw(Box::new(e)),
6831 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
6832 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
6833 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
6834 fn drop(&mut self) {
6836 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6837 let _ = unsafe { Box::from_raw(self.contents.result) };
6840 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6841 let _ = unsafe { Box::from_raw(self.contents.err) };
6846 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
6847 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
6848 let contents = if o.result_ok {
6849 let result = unsafe { o.contents.result };
6850 unsafe { o.contents.result = std::ptr::null_mut() };
6851 CResult_ChannelAnnouncementDecodeErrorZPtr { result }
6853 let err = unsafe { o.contents.err };
6854 unsafe { o.contents.err = std::ptr::null_mut(); }
6855 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
6859 result_ok: o.result_ok,
6863 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
6864 fn clone(&self) -> Self {
6866 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
6867 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
6870 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
6871 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6877 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
6878 /// but with all dynamically-allocated buffers duplicated in new buffers.
6879 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { orig.clone() }
6881 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
6882 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
6883 /// A pointer to the contents in the success state.
6884 /// Reading from this pointer when `result_ok` is not set is undefined.
6885 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
6886 /// A pointer to the contents in the error state.
6887 /// Reading from this pointer when `result_ok` is set is undefined.
6888 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6891 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
6892 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
6893 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6894 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
6895 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
6896 /// `err` or `result` depending on the state of `result_ok`.
6897 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
6898 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
6899 pub result_ok: bool,
6902 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
6903 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
6904 CResult_UnsignedChannelUpdateDecodeErrorZ {
6905 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
6906 result: Box::into_raw(Box::new(o)),
6912 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
6913 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
6914 CResult_UnsignedChannelUpdateDecodeErrorZ {
6915 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
6916 err: Box::into_raw(Box::new(e)),
6922 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
6923 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
6924 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
6925 fn drop(&mut self) {
6927 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6928 let _ = unsafe { Box::from_raw(self.contents.result) };
6931 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6932 let _ = unsafe { Box::from_raw(self.contents.err) };
6937 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
6938 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
6939 let contents = if o.result_ok {
6940 let result = unsafe { o.contents.result };
6941 unsafe { o.contents.result = std::ptr::null_mut() };
6942 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
6944 let err = unsafe { o.contents.err };
6945 unsafe { o.contents.err = std::ptr::null_mut(); }
6946 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
6950 result_ok: o.result_ok,
6954 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
6955 fn clone(&self) -> Self {
6957 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
6958 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
6961 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
6962 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6968 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
6969 /// but with all dynamically-allocated buffers duplicated in new buffers.
6970 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { orig.clone() }
6972 /// The contents of CResult_ChannelUpdateDecodeErrorZ
6973 pub union CResult_ChannelUpdateDecodeErrorZPtr {
6974 /// A pointer to the contents in the success state.
6975 /// Reading from this pointer when `result_ok` is not set is undefined.
6976 pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
6977 /// A pointer to the contents in the error state.
6978 /// Reading from this pointer when `result_ok` is set is undefined.
6979 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6982 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
6983 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
6984 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6985 pub struct CResult_ChannelUpdateDecodeErrorZ {
6986 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
6987 /// `err` or `result` depending on the state of `result_ok`.
6988 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
6989 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
6990 pub result_ok: bool,
6993 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
6994 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
6995 CResult_ChannelUpdateDecodeErrorZ {
6996 contents: CResult_ChannelUpdateDecodeErrorZPtr {
6997 result: Box::into_raw(Box::new(o)),
7003 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
7004 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
7005 CResult_ChannelUpdateDecodeErrorZ {
7006 contents: CResult_ChannelUpdateDecodeErrorZPtr {
7007 err: Box::into_raw(Box::new(e)),
7013 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
7014 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
7015 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
7016 fn drop(&mut self) {
7018 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7019 let _ = unsafe { Box::from_raw(self.contents.result) };
7022 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7023 let _ = unsafe { Box::from_raw(self.contents.err) };
7028 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
7029 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
7030 let contents = if o.result_ok {
7031 let result = unsafe { o.contents.result };
7032 unsafe { o.contents.result = std::ptr::null_mut() };
7033 CResult_ChannelUpdateDecodeErrorZPtr { result }
7035 let err = unsafe { o.contents.err };
7036 unsafe { o.contents.err = std::ptr::null_mut(); }
7037 CResult_ChannelUpdateDecodeErrorZPtr { err }
7041 result_ok: o.result_ok,
7045 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
7046 fn clone(&self) -> Self {
7048 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
7049 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
7052 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
7053 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7059 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
7060 /// but with all dynamically-allocated buffers duplicated in new buffers.
7061 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { orig.clone() }
7063 /// The contents of CResult_ErrorMessageDecodeErrorZ
7064 pub union CResult_ErrorMessageDecodeErrorZPtr {
7065 /// A pointer to the contents in the success state.
7066 /// Reading from this pointer when `result_ok` is not set is undefined.
7067 pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
7068 /// A pointer to the contents in the error state.
7069 /// Reading from this pointer when `result_ok` is set is undefined.
7070 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7073 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
7074 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
7075 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7076 pub struct CResult_ErrorMessageDecodeErrorZ {
7077 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
7078 /// `err` or `result` depending on the state of `result_ok`.
7079 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
7080 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
7081 pub result_ok: bool,
7084 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
7085 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
7086 CResult_ErrorMessageDecodeErrorZ {
7087 contents: CResult_ErrorMessageDecodeErrorZPtr {
7088 result: Box::into_raw(Box::new(o)),
7094 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
7095 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
7096 CResult_ErrorMessageDecodeErrorZ {
7097 contents: CResult_ErrorMessageDecodeErrorZPtr {
7098 err: Box::into_raw(Box::new(e)),
7104 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
7105 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
7106 impl Drop for CResult_ErrorMessageDecodeErrorZ {
7107 fn drop(&mut self) {
7109 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7110 let _ = unsafe { Box::from_raw(self.contents.result) };
7113 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7114 let _ = unsafe { Box::from_raw(self.contents.err) };
7119 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
7120 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
7121 let contents = if o.result_ok {
7122 let result = unsafe { o.contents.result };
7123 unsafe { o.contents.result = std::ptr::null_mut() };
7124 CResult_ErrorMessageDecodeErrorZPtr { result }
7126 let err = unsafe { o.contents.err };
7127 unsafe { o.contents.err = std::ptr::null_mut(); }
7128 CResult_ErrorMessageDecodeErrorZPtr { err }
7132 result_ok: o.result_ok,
7136 impl Clone for CResult_ErrorMessageDecodeErrorZ {
7137 fn clone(&self) -> Self {
7139 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
7140 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
7143 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
7144 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7150 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
7151 /// but with all dynamically-allocated buffers duplicated in new buffers.
7152 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { orig.clone() }
7154 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
7155 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
7156 /// A pointer to the contents in the success state.
7157 /// Reading from this pointer when `result_ok` is not set is undefined.
7158 pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
7159 /// A pointer to the contents in the error state.
7160 /// Reading from this pointer when `result_ok` is set is undefined.
7161 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7164 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
7165 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
7166 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7167 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
7168 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
7169 /// `err` or `result` depending on the state of `result_ok`.
7170 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
7171 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
7172 pub result_ok: bool,
7175 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
7176 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
7177 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
7178 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
7179 result: Box::into_raw(Box::new(o)),
7185 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
7186 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
7187 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
7188 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
7189 err: Box::into_raw(Box::new(e)),
7195 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
7196 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
7197 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
7198 fn drop(&mut self) {
7200 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7201 let _ = unsafe { Box::from_raw(self.contents.result) };
7204 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7205 let _ = unsafe { Box::from_raw(self.contents.err) };
7210 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
7211 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
7212 let contents = if o.result_ok {
7213 let result = unsafe { o.contents.result };
7214 unsafe { o.contents.result = std::ptr::null_mut() };
7215 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
7217 let err = unsafe { o.contents.err };
7218 unsafe { o.contents.err = std::ptr::null_mut(); }
7219 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
7223 result_ok: o.result_ok,
7227 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
7228 fn clone(&self) -> Self {
7230 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
7231 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
7234 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
7235 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7241 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
7242 /// but with all dynamically-allocated buffers duplicated in new buffers.
7243 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { orig.clone() }
7245 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
7246 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
7247 /// A pointer to the contents in the success state.
7248 /// Reading from this pointer when `result_ok` is not set is undefined.
7249 pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
7250 /// A pointer to the contents in the error state.
7251 /// Reading from this pointer when `result_ok` is set is undefined.
7252 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7255 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
7256 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
7257 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7258 pub struct CResult_NodeAnnouncementDecodeErrorZ {
7259 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
7260 /// `err` or `result` depending on the state of `result_ok`.
7261 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
7262 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
7263 pub result_ok: bool,
7266 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
7267 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
7268 CResult_NodeAnnouncementDecodeErrorZ {
7269 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
7270 result: Box::into_raw(Box::new(o)),
7276 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
7277 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
7278 CResult_NodeAnnouncementDecodeErrorZ {
7279 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
7280 err: Box::into_raw(Box::new(e)),
7286 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
7287 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
7288 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
7289 fn drop(&mut self) {
7291 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7292 let _ = unsafe { Box::from_raw(self.contents.result) };
7295 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7296 let _ = unsafe { Box::from_raw(self.contents.err) };
7301 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
7302 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
7303 let contents = if o.result_ok {
7304 let result = unsafe { o.contents.result };
7305 unsafe { o.contents.result = std::ptr::null_mut() };
7306 CResult_NodeAnnouncementDecodeErrorZPtr { result }
7308 let err = unsafe { o.contents.err };
7309 unsafe { o.contents.err = std::ptr::null_mut(); }
7310 CResult_NodeAnnouncementDecodeErrorZPtr { err }
7314 result_ok: o.result_ok,
7318 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
7319 fn clone(&self) -> Self {
7321 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
7322 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
7325 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
7326 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7332 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
7333 /// but with all dynamically-allocated buffers duplicated in new buffers.
7334 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { orig.clone() }
7336 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
7337 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
7338 /// A pointer to the contents in the success state.
7339 /// Reading from this pointer when `result_ok` is not set is undefined.
7340 pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
7341 /// A pointer to the contents in the error state.
7342 /// Reading from this pointer when `result_ok` is set is undefined.
7343 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7346 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
7347 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
7348 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7349 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
7350 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
7351 /// `err` or `result` depending on the state of `result_ok`.
7352 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
7353 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
7354 pub result_ok: bool,
7357 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
7358 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
7359 CResult_QueryShortChannelIdsDecodeErrorZ {
7360 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
7361 result: Box::into_raw(Box::new(o)),
7367 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
7368 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
7369 CResult_QueryShortChannelIdsDecodeErrorZ {
7370 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
7371 err: Box::into_raw(Box::new(e)),
7377 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
7378 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
7379 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
7380 fn drop(&mut self) {
7382 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7383 let _ = unsafe { Box::from_raw(self.contents.result) };
7386 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7387 let _ = unsafe { Box::from_raw(self.contents.err) };
7392 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
7393 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
7394 let contents = if o.result_ok {
7395 let result = unsafe { o.contents.result };
7396 unsafe { o.contents.result = std::ptr::null_mut() };
7397 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
7399 let err = unsafe { o.contents.err };
7400 unsafe { o.contents.err = std::ptr::null_mut(); }
7401 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
7405 result_ok: o.result_ok,
7409 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
7410 fn clone(&self) -> Self {
7412 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
7413 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
7416 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
7417 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7423 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
7424 /// but with all dynamically-allocated buffers duplicated in new buffers.
7425 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { orig.clone() }
7427 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
7428 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
7429 /// A pointer to the contents in the success state.
7430 /// Reading from this pointer when `result_ok` is not set is undefined.
7431 pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
7432 /// A pointer to the contents in the error state.
7433 /// Reading from this pointer when `result_ok` is set is undefined.
7434 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7437 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
7438 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
7439 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7440 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
7441 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
7442 /// `err` or `result` depending on the state of `result_ok`.
7443 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
7444 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
7445 pub result_ok: bool,
7448 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
7449 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
7450 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
7451 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
7452 result: Box::into_raw(Box::new(o)),
7458 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
7459 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
7460 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
7461 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
7462 err: Box::into_raw(Box::new(e)),
7468 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
7469 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
7470 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
7471 fn drop(&mut self) {
7473 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7474 let _ = unsafe { Box::from_raw(self.contents.result) };
7477 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7478 let _ = unsafe { Box::from_raw(self.contents.err) };
7483 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
7484 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
7485 let contents = if o.result_ok {
7486 let result = unsafe { o.contents.result };
7487 unsafe { o.contents.result = std::ptr::null_mut() };
7488 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
7490 let err = unsafe { o.contents.err };
7491 unsafe { o.contents.err = std::ptr::null_mut(); }
7492 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
7496 result_ok: o.result_ok,
7500 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
7501 fn clone(&self) -> Self {
7503 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
7504 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
7507 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
7508 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7514 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
7515 /// but with all dynamically-allocated buffers duplicated in new buffers.
7516 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { orig.clone() }
7518 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
7519 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
7520 /// A pointer to the contents in the success state.
7521 /// Reading from this pointer when `result_ok` is not set is undefined.
7522 pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
7523 /// A pointer to the contents in the error state.
7524 /// Reading from this pointer when `result_ok` is set is undefined.
7525 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7528 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
7529 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
7530 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7531 pub struct CResult_QueryChannelRangeDecodeErrorZ {
7532 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
7533 /// `err` or `result` depending on the state of `result_ok`.
7534 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
7535 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
7536 pub result_ok: bool,
7539 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
7540 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
7541 CResult_QueryChannelRangeDecodeErrorZ {
7542 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
7543 result: Box::into_raw(Box::new(o)),
7549 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
7550 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
7551 CResult_QueryChannelRangeDecodeErrorZ {
7552 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
7553 err: Box::into_raw(Box::new(e)),
7559 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
7560 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
7561 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
7562 fn drop(&mut self) {
7564 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7565 let _ = unsafe { Box::from_raw(self.contents.result) };
7568 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7569 let _ = unsafe { Box::from_raw(self.contents.err) };
7574 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
7575 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
7576 let contents = if o.result_ok {
7577 let result = unsafe { o.contents.result };
7578 unsafe { o.contents.result = std::ptr::null_mut() };
7579 CResult_QueryChannelRangeDecodeErrorZPtr { result }
7581 let err = unsafe { o.contents.err };
7582 unsafe { o.contents.err = std::ptr::null_mut(); }
7583 CResult_QueryChannelRangeDecodeErrorZPtr { err }
7587 result_ok: o.result_ok,
7591 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
7592 fn clone(&self) -> Self {
7594 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
7595 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
7598 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
7599 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7605 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
7606 /// but with all dynamically-allocated buffers duplicated in new buffers.
7607 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { orig.clone() }
7609 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
7610 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
7611 /// A pointer to the contents in the success state.
7612 /// Reading from this pointer when `result_ok` is not set is undefined.
7613 pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
7614 /// A pointer to the contents in the error state.
7615 /// Reading from this pointer when `result_ok` is set is undefined.
7616 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7619 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
7620 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
7621 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7622 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
7623 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
7624 /// `err` or `result` depending on the state of `result_ok`.
7625 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
7626 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
7627 pub result_ok: bool,
7630 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
7631 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
7632 CResult_ReplyChannelRangeDecodeErrorZ {
7633 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
7634 result: Box::into_raw(Box::new(o)),
7640 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
7641 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
7642 CResult_ReplyChannelRangeDecodeErrorZ {
7643 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
7644 err: Box::into_raw(Box::new(e)),
7650 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
7651 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
7652 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
7653 fn drop(&mut self) {
7655 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7656 let _ = unsafe { Box::from_raw(self.contents.result) };
7659 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7660 let _ = unsafe { Box::from_raw(self.contents.err) };
7665 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
7666 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
7667 let contents = if o.result_ok {
7668 let result = unsafe { o.contents.result };
7669 unsafe { o.contents.result = std::ptr::null_mut() };
7670 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
7672 let err = unsafe { o.contents.err };
7673 unsafe { o.contents.err = std::ptr::null_mut(); }
7674 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
7678 result_ok: o.result_ok,
7682 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
7683 fn clone(&self) -> Self {
7685 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
7686 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
7689 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
7690 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7696 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
7697 /// but with all dynamically-allocated buffers duplicated in new buffers.
7698 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { orig.clone() }
7700 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
7701 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
7702 /// A pointer to the contents in the success state.
7703 /// Reading from this pointer when `result_ok` is not set is undefined.
7704 pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
7705 /// A pointer to the contents in the error state.
7706 /// Reading from this pointer when `result_ok` is set is undefined.
7707 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7710 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
7711 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
7712 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7713 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
7714 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
7715 /// `err` or `result` depending on the state of `result_ok`.
7716 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
7717 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
7718 pub result_ok: bool,
7721 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
7722 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
7723 CResult_GossipTimestampFilterDecodeErrorZ {
7724 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
7725 result: Box::into_raw(Box::new(o)),
7731 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
7732 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
7733 CResult_GossipTimestampFilterDecodeErrorZ {
7734 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
7735 err: Box::into_raw(Box::new(e)),
7741 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
7742 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
7743 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
7744 fn drop(&mut self) {
7746 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7747 let _ = unsafe { Box::from_raw(self.contents.result) };
7750 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7751 let _ = unsafe { Box::from_raw(self.contents.err) };
7756 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
7757 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
7758 let contents = if o.result_ok {
7759 let result = unsafe { o.contents.result };
7760 unsafe { o.contents.result = std::ptr::null_mut() };
7761 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
7763 let err = unsafe { o.contents.err };
7764 unsafe { o.contents.err = std::ptr::null_mut(); }
7765 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
7769 result_ok: o.result_ok,
7773 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
7774 fn clone(&self) -> Self {
7776 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
7777 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
7780 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
7781 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7787 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
7788 /// but with all dynamically-allocated buffers duplicated in new buffers.
7789 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { orig.clone() }
7791 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
7792 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
7793 /// A pointer to the contents in the success state.
7794 /// Reading from this pointer when `result_ok` is not set is undefined.
7795 pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
7796 /// A pointer to the contents in the error state.
7797 /// Reading from this pointer when `result_ok` is set is undefined.
7798 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7801 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
7802 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
7803 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7804 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
7805 /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
7806 /// `err` or `result` depending on the state of `result_ok`.
7807 pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
7808 /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
7809 pub result_ok: bool,
7812 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
7813 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
7814 CResult_SpendableOutputDescriptorDecodeErrorZ {
7815 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
7816 result: Box::into_raw(Box::new(o)),
7822 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
7823 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
7824 CResult_SpendableOutputDescriptorDecodeErrorZ {
7825 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
7826 err: Box::into_raw(Box::new(e)),
7832 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
7833 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
7834 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
7835 fn drop(&mut self) {
7837 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7838 let _ = unsafe { Box::from_raw(self.contents.result) };
7841 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7842 let _ = unsafe { Box::from_raw(self.contents.err) };
7847 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
7848 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
7849 let contents = if o.result_ok {
7850 let result = unsafe { o.contents.result };
7851 unsafe { o.contents.result = std::ptr::null_mut() };
7852 CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
7854 let err = unsafe { o.contents.err };
7855 unsafe { o.contents.err = std::ptr::null_mut(); }
7856 CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
7860 result_ok: o.result_ok,
7864 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
7865 fn clone(&self) -> Self {
7867 Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
7868 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
7871 Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
7872 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7878 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
7879 /// but with all dynamically-allocated buffers duplicated in new buffers.
7880 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { orig.clone() }
7882 /// A tuple of 2 elements. See the individual fields for the types contained.
7883 pub struct C2Tuple_SignatureCVec_SignatureZZ {
7884 /// The element at position 0
7885 pub a: crate::c_types::Signature,
7886 /// The element at position 1
7887 pub b: crate::c_types::derived::CVec_SignatureZ,
7889 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
7890 fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
7897 impl C2Tuple_SignatureCVec_SignatureZZ {
7898 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
7902 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
7903 fn clone(&self) -> Self {
7911 /// Creates a new tuple which has the same data as `orig`
7912 /// but with all dynamically-allocated buffers duplicated in new buffers.
7913 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { orig.clone() }
7914 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
7916 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
7917 C2Tuple_SignatureCVec_SignatureZZ { a, b, }
7921 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
7922 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
7924 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
7925 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
7926 /// A pointer to the contents in the success state.
7927 /// Reading from this pointer when `result_ok` is not set is undefined.
7928 pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
7929 /// Note that this value is always NULL, as there are no contents in the Err variant
7930 pub err: *mut std::ffi::c_void,
7933 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
7934 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
7935 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7936 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7937 /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
7938 /// `err` or `result` depending on the state of `result_ok`.
7939 pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
7940 /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
7941 pub result_ok: bool,
7944 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
7945 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7946 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7947 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
7948 result: Box::into_raw(Box::new(o)),
7954 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
7955 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7956 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7957 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
7958 err: std::ptr::null_mut(),
7964 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
7965 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
7966 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7967 fn drop(&mut self) {
7969 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7970 let _ = unsafe { Box::from_raw(self.contents.result) };
7976 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, u8>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7977 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, u8>) -> Self {
7978 let contents = if o.result_ok {
7979 let result = unsafe { o.contents.result };
7980 unsafe { o.contents.result = std::ptr::null_mut() };
7981 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
7983 let _ = unsafe { Box::from_raw(o.contents.err) };
7984 o.contents.err = std::ptr::null_mut();
7985 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: std::ptr::null_mut() }
7989 result_ok: o.result_ok,
7993 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
7994 fn clone(&self) -> Self {
7996 Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
7997 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
8000 Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
8001 err: std::ptr::null_mut()
8007 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
8008 /// but with all dynamically-allocated buffers duplicated in new buffers.
8009 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { orig.clone() }
8011 /// The contents of CResult_SignatureNoneZ
8012 pub union CResult_SignatureNoneZPtr {
8013 /// A pointer to the contents in the success state.
8014 /// Reading from this pointer when `result_ok` is not set is undefined.
8015 pub result: *mut crate::c_types::Signature,
8016 /// Note that this value is always NULL, as there are no contents in the Err variant
8017 pub err: *mut std::ffi::c_void,
8020 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
8021 /// containing a crate::c_types::Signature on success and a () on failure.
8022 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8023 pub struct CResult_SignatureNoneZ {
8024 /// The contents of this CResult_SignatureNoneZ, accessible via either
8025 /// `err` or `result` depending on the state of `result_ok`.
8026 pub contents: CResult_SignatureNoneZPtr,
8027 /// Whether this CResult_SignatureNoneZ represents a success state.
8028 pub result_ok: bool,
8031 /// Creates a new CResult_SignatureNoneZ in the success state.
8032 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
8033 CResult_SignatureNoneZ {
8034 contents: CResult_SignatureNoneZPtr {
8035 result: Box::into_raw(Box::new(o)),
8041 /// Creates a new CResult_SignatureNoneZ in the error state.
8042 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
8043 CResult_SignatureNoneZ {
8044 contents: CResult_SignatureNoneZPtr {
8045 err: std::ptr::null_mut(),
8051 /// Frees any resources used by the CResult_SignatureNoneZ.
8052 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
8053 impl Drop for CResult_SignatureNoneZ {
8054 fn drop(&mut self) {
8056 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8057 let _ = unsafe { Box::from_raw(self.contents.result) };
8063 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, u8>> for CResult_SignatureNoneZ {
8064 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, u8>) -> Self {
8065 let contents = if o.result_ok {
8066 let result = unsafe { o.contents.result };
8067 unsafe { o.contents.result = std::ptr::null_mut() };
8068 CResult_SignatureNoneZPtr { result }
8070 let _ = unsafe { Box::from_raw(o.contents.err) };
8071 o.contents.err = std::ptr::null_mut();
8072 CResult_SignatureNoneZPtr { err: std::ptr::null_mut() }
8076 result_ok: o.result_ok,
8080 impl Clone for CResult_SignatureNoneZ {
8081 fn clone(&self) -> Self {
8083 Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
8084 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
8087 Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
8088 err: std::ptr::null_mut()
8094 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
8095 /// but with all dynamically-allocated buffers duplicated in new buffers.
8096 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { orig.clone() }
8098 /// The contents of CResult_SignDecodeErrorZ
8099 pub union CResult_SignDecodeErrorZPtr {
8100 /// A pointer to the contents in the success state.
8101 /// Reading from this pointer when `result_ok` is not set is undefined.
8102 pub result: *mut crate::lightning::chain::keysinterface::Sign,
8103 /// A pointer to the contents in the error state.
8104 /// Reading from this pointer when `result_ok` is set is undefined.
8105 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8108 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
8109 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
8110 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8111 pub struct CResult_SignDecodeErrorZ {
8112 /// The contents of this CResult_SignDecodeErrorZ, accessible via either
8113 /// `err` or `result` depending on the state of `result_ok`.
8114 pub contents: CResult_SignDecodeErrorZPtr,
8115 /// Whether this CResult_SignDecodeErrorZ represents a success state.
8116 pub result_ok: bool,
8119 /// Creates a new CResult_SignDecodeErrorZ in the success state.
8120 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
8121 CResult_SignDecodeErrorZ {
8122 contents: CResult_SignDecodeErrorZPtr {
8123 result: Box::into_raw(Box::new(o)),
8129 /// Creates a new CResult_SignDecodeErrorZ in the error state.
8130 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
8131 CResult_SignDecodeErrorZ {
8132 contents: CResult_SignDecodeErrorZPtr {
8133 err: Box::into_raw(Box::new(e)),
8139 /// Frees any resources used by the CResult_SignDecodeErrorZ.
8140 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
8141 impl Drop for CResult_SignDecodeErrorZ {
8142 fn drop(&mut self) {
8144 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8145 let _ = unsafe { Box::from_raw(self.contents.result) };
8148 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8149 let _ = unsafe { Box::from_raw(self.contents.err) };
8154 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
8155 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
8156 let contents = if o.result_ok {
8157 let result = unsafe { o.contents.result };
8158 unsafe { o.contents.result = std::ptr::null_mut() };
8159 CResult_SignDecodeErrorZPtr { result }
8161 let err = unsafe { o.contents.err };
8162 unsafe { o.contents.err = std::ptr::null_mut(); }
8163 CResult_SignDecodeErrorZPtr { err }
8167 result_ok: o.result_ok,
8171 impl Clone for CResult_SignDecodeErrorZ {
8172 fn clone(&self) -> Self {
8174 Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
8175 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
8178 Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
8179 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8185 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
8186 /// but with all dynamically-allocated buffers duplicated in new buffers.
8187 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { orig.clone() }
8189 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
8190 /// This corresponds to std::vector in C++
8191 pub struct CVec_CVec_u8ZZ {
8192 /// The elements in the array.
8193 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8194 pub data: *mut crate::c_types::derived::CVec_u8Z,
8195 /// The number of elements pointed to by `data`.
8198 impl CVec_CVec_u8ZZ {
8199 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
8200 if self.datalen == 0 { return Vec::new(); }
8201 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8202 self.data = std::ptr::null_mut();
8206 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
8207 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8210 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
8211 fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
8212 let datalen = v.len();
8213 let data = Box::into_raw(v.into_boxed_slice());
8214 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8218 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8219 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
8220 impl Drop for CVec_CVec_u8ZZ {
8221 fn drop(&mut self) {
8222 if self.datalen == 0 { return; }
8223 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8226 impl Clone for CVec_CVec_u8ZZ {
8227 fn clone(&self) -> Self {
8228 let mut res = Vec::new();
8229 if self.datalen == 0 { return Self::from(res); }
8230 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8235 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
8236 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
8237 /// A pointer to the contents in the success state.
8238 /// Reading from this pointer when `result_ok` is not set is undefined.
8239 pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
8240 /// Note that this value is always NULL, as there are no contents in the Err variant
8241 pub err: *mut std::ffi::c_void,
8244 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
8245 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
8246 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8247 pub struct CResult_CVec_CVec_u8ZZNoneZ {
8248 /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
8249 /// `err` or `result` depending on the state of `result_ok`.
8250 pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
8251 /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
8252 pub result_ok: bool,
8255 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
8256 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
8257 CResult_CVec_CVec_u8ZZNoneZ {
8258 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
8259 result: Box::into_raw(Box::new(o)),
8265 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
8266 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
8267 CResult_CVec_CVec_u8ZZNoneZ {
8268 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
8269 err: std::ptr::null_mut(),
8275 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
8276 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
8277 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
8278 fn drop(&mut self) {
8280 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8281 let _ = unsafe { Box::from_raw(self.contents.result) };
8287 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, u8>> for CResult_CVec_CVec_u8ZZNoneZ {
8288 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, u8>) -> Self {
8289 let contents = if o.result_ok {
8290 let result = unsafe { o.contents.result };
8291 unsafe { o.contents.result = std::ptr::null_mut() };
8292 CResult_CVec_CVec_u8ZZNoneZPtr { result }
8294 let _ = unsafe { Box::from_raw(o.contents.err) };
8295 o.contents.err = std::ptr::null_mut();
8296 CResult_CVec_CVec_u8ZZNoneZPtr { err: std::ptr::null_mut() }
8300 result_ok: o.result_ok,
8304 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
8305 fn clone(&self) -> Self {
8307 Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
8308 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
8311 Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
8312 err: std::ptr::null_mut()
8318 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
8319 /// but with all dynamically-allocated buffers duplicated in new buffers.
8320 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { orig.clone() }
8322 /// The contents of CResult_InMemorySignerDecodeErrorZ
8323 pub union CResult_InMemorySignerDecodeErrorZPtr {
8324 /// A pointer to the contents in the success state.
8325 /// Reading from this pointer when `result_ok` is not set is undefined.
8326 pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
8327 /// A pointer to the contents in the error state.
8328 /// Reading from this pointer when `result_ok` is set is undefined.
8329 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8332 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
8333 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
8334 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8335 pub struct CResult_InMemorySignerDecodeErrorZ {
8336 /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
8337 /// `err` or `result` depending on the state of `result_ok`.
8338 pub contents: CResult_InMemorySignerDecodeErrorZPtr,
8339 /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
8340 pub result_ok: bool,
8343 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
8344 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
8345 CResult_InMemorySignerDecodeErrorZ {
8346 contents: CResult_InMemorySignerDecodeErrorZPtr {
8347 result: Box::into_raw(Box::new(o)),
8353 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
8354 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
8355 CResult_InMemorySignerDecodeErrorZ {
8356 contents: CResult_InMemorySignerDecodeErrorZPtr {
8357 err: Box::into_raw(Box::new(e)),
8363 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
8364 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
8365 impl Drop for CResult_InMemorySignerDecodeErrorZ {
8366 fn drop(&mut self) {
8368 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8369 let _ = unsafe { Box::from_raw(self.contents.result) };
8372 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8373 let _ = unsafe { Box::from_raw(self.contents.err) };
8378 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
8379 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
8380 let contents = if o.result_ok {
8381 let result = unsafe { o.contents.result };
8382 unsafe { o.contents.result = std::ptr::null_mut() };
8383 CResult_InMemorySignerDecodeErrorZPtr { result }
8385 let err = unsafe { o.contents.err };
8386 unsafe { o.contents.err = std::ptr::null_mut(); }
8387 CResult_InMemorySignerDecodeErrorZPtr { err }
8391 result_ok: o.result_ok,
8395 impl Clone for CResult_InMemorySignerDecodeErrorZ {
8396 fn clone(&self) -> Self {
8398 Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
8399 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
8402 Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
8403 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8409 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
8410 /// but with all dynamically-allocated buffers duplicated in new buffers.
8411 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { orig.clone() }
8413 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
8414 /// This corresponds to std::vector in C++
8415 pub struct CVec_TxOutZ {
8416 /// The elements in the array.
8417 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8418 pub data: *mut crate::c_types::TxOut,
8419 /// The number of elements pointed to by `data`.
8423 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
8424 if self.datalen == 0 { return Vec::new(); }
8425 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8426 self.data = std::ptr::null_mut();
8430 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
8431 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8434 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
8435 fn from(v: Vec<crate::c_types::TxOut>) -> Self {
8436 let datalen = v.len();
8437 let data = Box::into_raw(v.into_boxed_slice());
8438 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8442 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8443 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
8444 impl Drop for CVec_TxOutZ {
8445 fn drop(&mut self) {
8446 if self.datalen == 0 { return; }
8447 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8450 impl Clone for CVec_TxOutZ {
8451 fn clone(&self) -> Self {
8452 let mut res = Vec::new();
8453 if self.datalen == 0 { return Self::from(res); }
8454 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8459 /// The contents of CResult_TransactionNoneZ
8460 pub union CResult_TransactionNoneZPtr {
8461 /// A pointer to the contents in the success state.
8462 /// Reading from this pointer when `result_ok` is not set is undefined.
8463 pub result: *mut crate::c_types::Transaction,
8464 /// Note that this value is always NULL, as there are no contents in the Err variant
8465 pub err: *mut std::ffi::c_void,
8468 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
8469 /// containing a crate::c_types::Transaction on success and a () on failure.
8470 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8471 pub struct CResult_TransactionNoneZ {
8472 /// The contents of this CResult_TransactionNoneZ, accessible via either
8473 /// `err` or `result` depending on the state of `result_ok`.
8474 pub contents: CResult_TransactionNoneZPtr,
8475 /// Whether this CResult_TransactionNoneZ represents a success state.
8476 pub result_ok: bool,
8479 /// Creates a new CResult_TransactionNoneZ in the success state.
8480 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
8481 CResult_TransactionNoneZ {
8482 contents: CResult_TransactionNoneZPtr {
8483 result: Box::into_raw(Box::new(o)),
8489 /// Creates a new CResult_TransactionNoneZ in the error state.
8490 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
8491 CResult_TransactionNoneZ {
8492 contents: CResult_TransactionNoneZPtr {
8493 err: std::ptr::null_mut(),
8499 /// Frees any resources used by the CResult_TransactionNoneZ.
8500 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
8501 impl Drop for CResult_TransactionNoneZ {
8502 fn drop(&mut self) {
8504 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8505 let _ = unsafe { Box::from_raw(self.contents.result) };
8511 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, u8>> for CResult_TransactionNoneZ {
8512 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, u8>) -> Self {
8513 let contents = if o.result_ok {
8514 let result = unsafe { o.contents.result };
8515 unsafe { o.contents.result = std::ptr::null_mut() };
8516 CResult_TransactionNoneZPtr { result }
8518 let _ = unsafe { Box::from_raw(o.contents.err) };
8519 o.contents.err = std::ptr::null_mut();
8520 CResult_TransactionNoneZPtr { err: std::ptr::null_mut() }
8524 result_ok: o.result_ok,
8529 /// The contents of CResult_NoneAPIErrorZ
8530 pub union CResult_NoneAPIErrorZPtr {
8531 /// Note that this value is always NULL, as there are no contents in the OK variant
8532 pub result: *mut std::ffi::c_void,
8533 /// A pointer to the contents in the error state.
8534 /// Reading from this pointer when `result_ok` is set is undefined.
8535 pub err: *mut crate::lightning::util::errors::APIError,
8538 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
8539 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
8540 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8541 pub struct CResult_NoneAPIErrorZ {
8542 /// The contents of this CResult_NoneAPIErrorZ, accessible via either
8543 /// `err` or `result` depending on the state of `result_ok`.
8544 pub contents: CResult_NoneAPIErrorZPtr,
8545 /// Whether this CResult_NoneAPIErrorZ represents a success state.
8546 pub result_ok: bool,
8549 /// Creates a new CResult_NoneAPIErrorZ in the success state.
8550 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
8551 CResult_NoneAPIErrorZ {
8552 contents: CResult_NoneAPIErrorZPtr {
8553 result: std::ptr::null_mut(),
8559 /// Creates a new CResult_NoneAPIErrorZ in the error state.
8560 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
8561 CResult_NoneAPIErrorZ {
8562 contents: CResult_NoneAPIErrorZPtr {
8563 err: Box::into_raw(Box::new(e)),
8569 /// Frees any resources used by the CResult_NoneAPIErrorZ.
8570 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
8571 impl Drop for CResult_NoneAPIErrorZ {
8572 fn drop(&mut self) {
8575 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8576 let _ = unsafe { Box::from_raw(self.contents.err) };
8581 impl From<crate::c_types::CResultTempl<u8, crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
8582 fn from(mut o: crate::c_types::CResultTempl<u8, crate::lightning::util::errors::APIError>) -> Self {
8583 let contents = if o.result_ok {
8584 let _ = unsafe { Box::from_raw(o.contents.result) };
8585 o.contents.result = std::ptr::null_mut();
8586 CResult_NoneAPIErrorZPtr { result: std::ptr::null_mut() }
8588 let err = unsafe { o.contents.err };
8589 unsafe { o.contents.err = std::ptr::null_mut(); }
8590 CResult_NoneAPIErrorZPtr { err }
8594 result_ok: o.result_ok,
8598 impl Clone for CResult_NoneAPIErrorZ {
8599 fn clone(&self) -> Self {
8601 Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
8602 result: std::ptr::null_mut()
8605 Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
8606 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8612 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
8613 /// but with all dynamically-allocated buffers duplicated in new buffers.
8614 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { orig.clone() }
8616 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
8617 /// This corresponds to std::vector in C++
8618 pub struct CVec_CResult_NoneAPIErrorZZ {
8619 /// The elements in the array.
8620 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8621 pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
8622 /// The number of elements pointed to by `data`.
8625 impl CVec_CResult_NoneAPIErrorZZ {
8626 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
8627 if self.datalen == 0 { return Vec::new(); }
8628 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8629 self.data = std::ptr::null_mut();
8633 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
8634 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8637 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
8638 fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
8639 let datalen = v.len();
8640 let data = Box::into_raw(v.into_boxed_slice());
8641 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8645 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8646 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
8647 impl Drop for CVec_CResult_NoneAPIErrorZZ {
8648 fn drop(&mut self) {
8649 if self.datalen == 0 { return; }
8650 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8653 impl Clone for CVec_CResult_NoneAPIErrorZZ {
8654 fn clone(&self) -> Self {
8655 let mut res = Vec::new();
8656 if self.datalen == 0 { return Self::from(res); }
8657 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8662 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
8663 /// This corresponds to std::vector in C++
8664 pub struct CVec_APIErrorZ {
8665 /// The elements in the array.
8666 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8667 pub data: *mut crate::lightning::util::errors::APIError,
8668 /// The number of elements pointed to by `data`.
8671 impl CVec_APIErrorZ {
8672 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
8673 if self.datalen == 0 { return Vec::new(); }
8674 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8675 self.data = std::ptr::null_mut();
8679 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
8680 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8683 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
8684 fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
8685 let datalen = v.len();
8686 let data = Box::into_raw(v.into_boxed_slice());
8687 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8691 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8692 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
8693 impl Drop for CVec_APIErrorZ {
8694 fn drop(&mut self) {
8695 if self.datalen == 0 { return; }
8696 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8699 impl Clone for CVec_APIErrorZ {
8700 fn clone(&self) -> Self {
8701 let mut res = Vec::new();
8702 if self.datalen == 0 { return Self::from(res); }
8703 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8708 /// The contents of CResult_NonePaymentSendFailureZ
8709 pub union CResult_NonePaymentSendFailureZPtr {
8710 /// Note that this value is always NULL, as there are no contents in the OK variant
8711 pub result: *mut std::ffi::c_void,
8712 /// A pointer to the contents in the error state.
8713 /// Reading from this pointer when `result_ok` is set is undefined.
8714 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
8717 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
8718 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
8719 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8720 pub struct CResult_NonePaymentSendFailureZ {
8721 /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
8722 /// `err` or `result` depending on the state of `result_ok`.
8723 pub contents: CResult_NonePaymentSendFailureZPtr,
8724 /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
8725 pub result_ok: bool,
8728 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
8729 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
8730 CResult_NonePaymentSendFailureZ {
8731 contents: CResult_NonePaymentSendFailureZPtr {
8732 result: std::ptr::null_mut(),
8738 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
8739 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
8740 CResult_NonePaymentSendFailureZ {
8741 contents: CResult_NonePaymentSendFailureZPtr {
8742 err: Box::into_raw(Box::new(e)),
8748 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
8749 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
8750 impl Drop for CResult_NonePaymentSendFailureZ {
8751 fn drop(&mut self) {
8754 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8755 let _ = unsafe { Box::from_raw(self.contents.err) };
8760 impl From<crate::c_types::CResultTempl<u8, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
8761 fn from(mut o: crate::c_types::CResultTempl<u8, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
8762 let contents = if o.result_ok {
8763 let _ = unsafe { Box::from_raw(o.contents.result) };
8764 o.contents.result = std::ptr::null_mut();
8765 CResult_NonePaymentSendFailureZPtr { result: std::ptr::null_mut() }
8767 let err = unsafe { o.contents.err };
8768 unsafe { o.contents.err = std::ptr::null_mut(); }
8769 CResult_NonePaymentSendFailureZPtr { err }
8773 result_ok: o.result_ok,
8777 impl Clone for CResult_NonePaymentSendFailureZ {
8778 fn clone(&self) -> Self {
8780 Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
8781 result: std::ptr::null_mut()
8784 Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
8785 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8791 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
8792 /// but with all dynamically-allocated buffers duplicated in new buffers.
8793 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { orig.clone() }
8795 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
8796 /// This corresponds to std::vector in C++
8797 pub struct CVec_ChannelMonitorZ {
8798 /// The elements in the array.
8799 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8800 pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
8801 /// The number of elements pointed to by `data`.
8804 impl CVec_ChannelMonitorZ {
8805 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
8806 if self.datalen == 0 { return Vec::new(); }
8807 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8808 self.data = std::ptr::null_mut();
8812 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
8813 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8816 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
8817 fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
8818 let datalen = v.len();
8819 let data = Box::into_raw(v.into_boxed_slice());
8820 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8824 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8825 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
8826 impl Drop for CVec_ChannelMonitorZ {
8827 fn drop(&mut self) {
8828 if self.datalen == 0 { return; }
8829 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8833 /// A tuple of 2 elements. See the individual fields for the types contained.
8834 pub struct C2Tuple_BlockHashChannelManagerZ {
8835 /// The element at position 0
8836 pub a: crate::c_types::ThirtyTwoBytes,
8837 /// The element at position 1
8838 pub b: crate::lightning::ln::channelmanager::ChannelManager,
8840 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
8841 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
8848 impl C2Tuple_BlockHashChannelManagerZ {
8849 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
8853 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
8855 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
8856 C2Tuple_BlockHashChannelManagerZ { a, b, }
8860 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
8861 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
8863 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
8864 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
8865 /// A pointer to the contents in the success state.
8866 /// Reading from this pointer when `result_ok` is not set is undefined.
8867 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
8868 /// A pointer to the contents in the error state.
8869 /// Reading from this pointer when `result_ok` is set is undefined.
8870 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8873 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
8874 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
8875 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8876 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
8877 /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
8878 /// `err` or `result` depending on the state of `result_ok`.
8879 pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
8880 /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
8881 pub result_ok: bool,
8884 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
8885 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
8886 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
8887 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
8888 result: Box::into_raw(Box::new(o)),
8894 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
8895 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
8896 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
8897 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
8898 err: Box::into_raw(Box::new(e)),
8904 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
8905 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
8906 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
8907 fn drop(&mut self) {
8909 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8910 let _ = unsafe { Box::from_raw(self.contents.result) };
8913 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8914 let _ = unsafe { Box::from_raw(self.contents.err) };
8919 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
8920 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
8921 let contents = if o.result_ok {
8922 let result = unsafe { o.contents.result };
8923 unsafe { o.contents.result = std::ptr::null_mut() };
8924 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
8926 let err = unsafe { o.contents.err };
8927 unsafe { o.contents.err = std::ptr::null_mut(); }
8928 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
8932 result_ok: o.result_ok,