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_StringErrorZ
1372 pub union CResult_StringErrorZPtr {
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::c_types::derived::CVec_u8Z,
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::c_types::Secp256k1Error,
1381 /// A CResult_StringErrorZ represents the result of a fallible operation,
1382 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::c_types::Secp256k1Error on failure.
1383 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1384 pub struct CResult_StringErrorZ {
1385 /// The contents of this CResult_StringErrorZ, accessible via either
1386 /// `err` or `result` depending on the state of `result_ok`.
1387 pub contents: CResult_StringErrorZPtr,
1388 /// Whether this CResult_StringErrorZ represents a success state.
1389 pub result_ok: bool,
1392 /// Creates a new CResult_StringErrorZ in the success state.
1393 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_StringErrorZ {
1394 CResult_StringErrorZ {
1395 contents: CResult_StringErrorZPtr {
1396 result: Box::into_raw(Box::new(o)),
1402 /// Creates a new CResult_StringErrorZ in the error state.
1403 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
1404 CResult_StringErrorZ {
1405 contents: CResult_StringErrorZPtr {
1406 err: Box::into_raw(Box::new(e)),
1412 /// Frees any resources used by the CResult_StringErrorZ.
1413 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
1414 impl Drop for CResult_StringErrorZ {
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::c_types::derived::CVec_u8Z, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
1428 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::c_types::Secp256k1Error>) -> 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_StringErrorZPtr { result }
1434 let err = unsafe { o.contents.err };
1435 unsafe { o.contents.err = std::ptr::null_mut(); }
1436 CResult_StringErrorZPtr { err }
1440 result_ok: o.result_ok,
1445 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
1446 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
1447 /// A pointer to the contents in the success state.
1448 /// Reading from this pointer when `result_ok` is not set is undefined.
1449 pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
1450 /// A pointer to the contents in the error state.
1451 /// Reading from this pointer when `result_ok` is set is undefined.
1452 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1455 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
1456 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
1457 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1458 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
1459 /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
1460 /// `err` or `result` depending on the state of `result_ok`.
1461 pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
1462 /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
1463 pub result_ok: bool,
1466 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
1467 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
1468 CResult_ChannelMonitorUpdateDecodeErrorZ {
1469 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
1470 result: Box::into_raw(Box::new(o)),
1476 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
1477 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
1478 CResult_ChannelMonitorUpdateDecodeErrorZ {
1479 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
1480 err: Box::into_raw(Box::new(e)),
1486 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
1487 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
1488 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
1489 fn drop(&mut self) {
1491 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1492 let _ = unsafe { Box::from_raw(self.contents.result) };
1495 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1496 let _ = unsafe { Box::from_raw(self.contents.err) };
1501 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
1502 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
1503 let contents = if o.result_ok {
1504 let result = unsafe { o.contents.result };
1505 unsafe { o.contents.result = std::ptr::null_mut() };
1506 CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
1508 let err = unsafe { o.contents.err };
1509 unsafe { o.contents.err = std::ptr::null_mut(); }
1510 CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
1514 result_ok: o.result_ok,
1518 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
1519 fn clone(&self) -> Self {
1521 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
1522 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
1525 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
1526 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1532 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
1533 /// but with all dynamically-allocated buffers duplicated in new buffers.
1534 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { orig.clone() }
1536 /// The contents of CResult_HTLCUpdateDecodeErrorZ
1537 pub union CResult_HTLCUpdateDecodeErrorZPtr {
1538 /// A pointer to the contents in the success state.
1539 /// Reading from this pointer when `result_ok` is not set is undefined.
1540 pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
1541 /// A pointer to the contents in the error state.
1542 /// Reading from this pointer when `result_ok` is set is undefined.
1543 pub err: *mut crate::lightning::ln::msgs::DecodeError,
1546 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
1547 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
1548 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1549 pub struct CResult_HTLCUpdateDecodeErrorZ {
1550 /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
1551 /// `err` or `result` depending on the state of `result_ok`.
1552 pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
1553 /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
1554 pub result_ok: bool,
1557 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
1558 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
1559 CResult_HTLCUpdateDecodeErrorZ {
1560 contents: CResult_HTLCUpdateDecodeErrorZPtr {
1561 result: Box::into_raw(Box::new(o)),
1567 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
1568 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
1569 CResult_HTLCUpdateDecodeErrorZ {
1570 contents: CResult_HTLCUpdateDecodeErrorZPtr {
1571 err: Box::into_raw(Box::new(e)),
1577 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
1578 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
1579 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
1580 fn drop(&mut self) {
1582 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1583 let _ = unsafe { Box::from_raw(self.contents.result) };
1586 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1587 let _ = unsafe { Box::from_raw(self.contents.err) };
1592 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
1593 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
1594 let contents = if o.result_ok {
1595 let result = unsafe { o.contents.result };
1596 unsafe { o.contents.result = std::ptr::null_mut() };
1597 CResult_HTLCUpdateDecodeErrorZPtr { result }
1599 let err = unsafe { o.contents.err };
1600 unsafe { o.contents.err = std::ptr::null_mut(); }
1601 CResult_HTLCUpdateDecodeErrorZPtr { err }
1605 result_ok: o.result_ok,
1609 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
1610 fn clone(&self) -> Self {
1612 Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
1613 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
1616 Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
1617 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1623 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
1624 /// but with all dynamically-allocated buffers duplicated in new buffers.
1625 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { orig.clone() }
1627 /// The contents of CResult_NoneMonitorUpdateErrorZ
1628 pub union CResult_NoneMonitorUpdateErrorZPtr {
1629 /// Note that this value is always NULL, as there are no contents in the OK variant
1630 pub result: *mut std::ffi::c_void,
1631 /// A pointer to the contents in the error state.
1632 /// Reading from this pointer when `result_ok` is set is undefined.
1633 pub err: *mut crate::lightning::chain::channelmonitor::MonitorUpdateError,
1636 /// A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
1637 /// containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
1638 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1639 pub struct CResult_NoneMonitorUpdateErrorZ {
1640 /// The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
1641 /// `err` or `result` depending on the state of `result_ok`.
1642 pub contents: CResult_NoneMonitorUpdateErrorZPtr,
1643 /// Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
1644 pub result_ok: bool,
1647 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
1648 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_ok() -> CResult_NoneMonitorUpdateErrorZ {
1649 CResult_NoneMonitorUpdateErrorZ {
1650 contents: CResult_NoneMonitorUpdateErrorZPtr {
1651 result: std::ptr::null_mut(),
1657 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
1658 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_err(e: crate::lightning::chain::channelmonitor::MonitorUpdateError) -> CResult_NoneMonitorUpdateErrorZ {
1659 CResult_NoneMonitorUpdateErrorZ {
1660 contents: CResult_NoneMonitorUpdateErrorZPtr {
1661 err: Box::into_raw(Box::new(e)),
1667 /// Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
1668 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_free(_res: CResult_NoneMonitorUpdateErrorZ) { }
1669 impl Drop for CResult_NoneMonitorUpdateErrorZ {
1670 fn drop(&mut self) {
1673 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1674 let _ = unsafe { Box::from_raw(self.contents.err) };
1679 impl From<crate::c_types::CResultTempl<u8, crate::lightning::chain::channelmonitor::MonitorUpdateError>> for CResult_NoneMonitorUpdateErrorZ {
1680 fn from(mut o: crate::c_types::CResultTempl<u8, crate::lightning::chain::channelmonitor::MonitorUpdateError>) -> Self {
1681 let contents = if o.result_ok {
1682 let _ = unsafe { Box::from_raw(o.contents.result) };
1683 o.contents.result = std::ptr::null_mut();
1684 CResult_NoneMonitorUpdateErrorZPtr { result: std::ptr::null_mut() }
1686 let err = unsafe { o.contents.err };
1687 unsafe { o.contents.err = std::ptr::null_mut(); }
1688 CResult_NoneMonitorUpdateErrorZPtr { err }
1692 result_ok: o.result_ok,
1696 impl Clone for CResult_NoneMonitorUpdateErrorZ {
1697 fn clone(&self) -> Self {
1699 Self { result_ok: true, contents: CResult_NoneMonitorUpdateErrorZPtr {
1700 result: std::ptr::null_mut()
1703 Self { result_ok: false, contents: CResult_NoneMonitorUpdateErrorZPtr {
1704 err: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::MonitorUpdateError>::clone(unsafe { &*self.contents.err })))
1710 /// Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
1711 /// but with all dynamically-allocated buffers duplicated in new buffers.
1712 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_clone(orig: &CResult_NoneMonitorUpdateErrorZ) -> CResult_NoneMonitorUpdateErrorZ { orig.clone() }
1714 /// A tuple of 2 elements. See the individual fields for the types contained.
1715 pub struct C2Tuple_OutPointScriptZ {
1716 /// The element at position 0
1717 pub a: crate::lightning::chain::transaction::OutPoint,
1718 /// The element at position 1
1719 pub b: crate::c_types::derived::CVec_u8Z,
1721 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
1722 fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
1729 impl C2Tuple_OutPointScriptZ {
1730 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
1734 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
1736 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
1737 C2Tuple_OutPointScriptZ { a, b, }
1741 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
1742 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
1744 /// A tuple of 2 elements. See the individual fields for the types contained.
1745 pub struct C2Tuple_u32ScriptZ {
1746 /// The element at position 0
1748 /// The element at position 1
1749 pub b: crate::c_types::derived::CVec_u8Z,
1751 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
1752 fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
1759 impl C2Tuple_u32ScriptZ {
1760 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
1764 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
1766 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
1767 C2Tuple_u32ScriptZ { a, b, }
1771 /// Frees any resources used by the C2Tuple_u32ScriptZ.
1772 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
1774 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
1775 /// This corresponds to std::vector in C++
1776 pub struct CVec_C2Tuple_u32ScriptZZ {
1777 /// The elements in the array.
1778 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1779 pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
1780 /// The number of elements pointed to by `data`.
1783 impl CVec_C2Tuple_u32ScriptZZ {
1784 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
1785 if self.datalen == 0 { return Vec::new(); }
1786 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1787 self.data = std::ptr::null_mut();
1791 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
1792 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1795 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
1796 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
1797 let datalen = v.len();
1798 let data = Box::into_raw(v.into_boxed_slice());
1799 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1803 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1804 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
1805 impl Drop for CVec_C2Tuple_u32ScriptZZ {
1806 fn drop(&mut self) {
1807 if self.datalen == 0 { return; }
1808 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1812 /// A tuple of 2 elements. See the individual fields for the types contained.
1813 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
1814 /// The element at position 0
1815 pub a: crate::c_types::ThirtyTwoBytes,
1816 /// The element at position 1
1817 pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
1819 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
1820 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
1827 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
1828 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
1832 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
1834 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 {
1835 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
1839 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
1840 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
1842 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
1843 /// This corresponds to std::vector in C++
1844 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
1845 /// The elements in the array.
1846 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1847 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
1848 /// The number of elements pointed to by `data`.
1851 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
1852 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
1853 if self.datalen == 0 { return Vec::new(); }
1854 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1855 self.data = std::ptr::null_mut();
1859 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
1860 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1863 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
1864 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
1865 let datalen = v.len();
1866 let data = Box::into_raw(v.into_boxed_slice());
1867 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1871 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1872 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
1873 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
1874 fn drop(&mut self) {
1875 if self.datalen == 0 { return; }
1876 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1880 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
1881 /// This corresponds to std::vector in C++
1882 pub struct CVec_MonitorEventZ {
1883 /// The elements in the array.
1884 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1885 pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
1886 /// The number of elements pointed to by `data`.
1889 impl CVec_MonitorEventZ {
1890 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
1891 if self.datalen == 0 { return Vec::new(); }
1892 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1893 self.data = std::ptr::null_mut();
1897 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
1898 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1901 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
1902 fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
1903 let datalen = v.len();
1904 let data = Box::into_raw(v.into_boxed_slice());
1905 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1909 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1910 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
1911 impl Drop for CVec_MonitorEventZ {
1912 fn drop(&mut self) {
1913 if self.datalen == 0 { return; }
1914 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1917 impl Clone for CVec_MonitorEventZ {
1918 fn clone(&self) -> Self {
1919 let mut res = Vec::new();
1920 if self.datalen == 0 { return Self::from(res); }
1921 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1926 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
1927 /// This corresponds to std::vector in C++
1928 pub struct CVec_EventZ {
1929 /// The elements in the array.
1930 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1931 pub data: *mut crate::lightning::util::events::Event,
1932 /// The number of elements pointed to by `data`.
1936 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
1937 if self.datalen == 0 { return Vec::new(); }
1938 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1939 self.data = std::ptr::null_mut();
1943 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
1944 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1947 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
1948 fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
1949 let datalen = v.len();
1950 let data = Box::into_raw(v.into_boxed_slice());
1951 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1955 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1956 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
1957 impl Drop for CVec_EventZ {
1958 fn drop(&mut self) {
1959 if self.datalen == 0 { return; }
1960 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1963 impl Clone for CVec_EventZ {
1964 fn clone(&self) -> Self {
1965 let mut res = Vec::new();
1966 if self.datalen == 0 { return Self::from(res); }
1967 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1972 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
1973 /// This corresponds to std::vector in C++
1974 pub struct CVec_TransactionZ {
1975 /// The elements in the array.
1976 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1977 pub data: *mut crate::c_types::Transaction,
1978 /// The number of elements pointed to by `data`.
1981 impl CVec_TransactionZ {
1982 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
1983 if self.datalen == 0 { return Vec::new(); }
1984 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1985 self.data = std::ptr::null_mut();
1989 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
1990 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1993 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
1994 fn from(v: Vec<crate::c_types::Transaction>) -> Self {
1995 let datalen = v.len();
1996 let data = Box::into_raw(v.into_boxed_slice());
1997 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2001 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2002 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
2003 impl Drop for CVec_TransactionZ {
2004 fn drop(&mut self) {
2005 if self.datalen == 0 { return; }
2006 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2010 /// A tuple of 2 elements. See the individual fields for the types contained.
2011 pub struct C2Tuple_usizeTransactionZ {
2012 /// The element at position 0
2014 /// The element at position 1
2015 pub b: crate::c_types::Transaction,
2017 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
2018 fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
2025 impl C2Tuple_usizeTransactionZ {
2026 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
2030 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
2032 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
2033 C2Tuple_usizeTransactionZ { a, b, }
2037 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
2038 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
2040 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
2041 /// This corresponds to std::vector in C++
2042 pub struct CVec_C2Tuple_usizeTransactionZZ {
2043 /// The elements in the array.
2044 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2045 pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
2046 /// The number of elements pointed to by `data`.
2049 impl CVec_C2Tuple_usizeTransactionZZ {
2050 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
2051 if self.datalen == 0 { return Vec::new(); }
2052 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2053 self.data = std::ptr::null_mut();
2057 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
2058 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2061 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
2062 fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
2063 let datalen = v.len();
2064 let data = Box::into_raw(v.into_boxed_slice());
2065 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2069 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2070 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
2071 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
2072 fn drop(&mut self) {
2073 if self.datalen == 0 { return; }
2074 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2078 /// A tuple of 2 elements. See the individual fields for the types contained.
2079 pub struct C2Tuple_u32TxOutZ {
2080 /// The element at position 0
2082 /// The element at position 1
2083 pub b: crate::c_types::TxOut,
2085 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
2086 fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
2093 impl C2Tuple_u32TxOutZ {
2094 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
2098 impl Clone for C2Tuple_u32TxOutZ {
2099 fn clone(&self) -> Self {
2107 /// Creates a new tuple which has the same data as `orig`
2108 /// but with all dynamically-allocated buffers duplicated in new buffers.
2109 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { orig.clone() }
2110 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
2112 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
2113 C2Tuple_u32TxOutZ { a, b, }
2117 /// Frees any resources used by the C2Tuple_u32TxOutZ.
2118 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
2120 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
2121 /// This corresponds to std::vector in C++
2122 pub struct CVec_C2Tuple_u32TxOutZZ {
2123 /// The elements in the array.
2124 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2125 pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
2126 /// The number of elements pointed to by `data`.
2129 impl CVec_C2Tuple_u32TxOutZZ {
2130 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
2131 if self.datalen == 0 { return Vec::new(); }
2132 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2133 self.data = std::ptr::null_mut();
2137 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
2138 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2141 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
2142 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
2143 let datalen = v.len();
2144 let data = Box::into_raw(v.into_boxed_slice());
2145 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2149 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2150 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
2151 impl Drop for CVec_C2Tuple_u32TxOutZZ {
2152 fn drop(&mut self) {
2153 if self.datalen == 0 { return; }
2154 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2157 impl Clone for CVec_C2Tuple_u32TxOutZZ {
2158 fn clone(&self) -> Self {
2159 let mut res = Vec::new();
2160 if self.datalen == 0 { return Self::from(res); }
2161 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2166 /// A tuple of 2 elements. See the individual fields for the types contained.
2167 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
2168 /// The element at position 0
2169 pub a: crate::c_types::ThirtyTwoBytes,
2170 /// The element at position 1
2171 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
2173 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
2174 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
2181 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
2182 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
2186 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
2188 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 {
2189 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
2193 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
2194 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
2196 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
2197 /// This corresponds to std::vector in C++
2198 pub struct CVec_TransactionOutputsZ {
2199 /// The elements in the array.
2200 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2201 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
2202 /// The number of elements pointed to by `data`.
2205 impl CVec_TransactionOutputsZ {
2206 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
2207 if self.datalen == 0 { return Vec::new(); }
2208 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2209 self.data = std::ptr::null_mut();
2213 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
2214 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2217 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
2218 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
2219 let datalen = v.len();
2220 let data = Box::into_raw(v.into_boxed_slice());
2221 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2225 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2226 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
2227 impl Drop for CVec_TransactionOutputsZ {
2228 fn drop(&mut self) {
2229 if self.datalen == 0 { return; }
2230 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2234 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
2235 /// This corresponds to std::vector in C++
2236 pub struct CVec_TxidZ {
2237 /// The elements in the array.
2238 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2239 pub data: *mut crate::c_types::ThirtyTwoBytes,
2240 /// The number of elements pointed to by `data`.
2244 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
2245 if self.datalen == 0 { return Vec::new(); }
2246 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2247 self.data = std::ptr::null_mut();
2251 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
2252 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2255 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
2256 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
2257 let datalen = v.len();
2258 let data = Box::into_raw(v.into_boxed_slice());
2259 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2263 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2264 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
2265 impl Drop for CVec_TxidZ {
2266 fn drop(&mut self) {
2267 if self.datalen == 0 { return; }
2268 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2272 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
2273 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
2274 /// Note that this value is always NULL, as there are no contents in the OK variant
2275 pub result: *mut std::ffi::c_void,
2276 /// A pointer to the contents in the error state.
2277 /// Reading from this pointer when `result_ok` is set is undefined.
2278 pub err: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr,
2281 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
2282 /// containing a () on success and a crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr on failure.
2283 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2284 pub struct CResult_NoneChannelMonitorUpdateErrZ {
2285 /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
2286 /// `err` or `result` depending on the state of `result_ok`.
2287 pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
2288 /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
2289 pub result_ok: bool,
2292 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
2293 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
2294 CResult_NoneChannelMonitorUpdateErrZ {
2295 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2296 result: std::ptr::null_mut(),
2302 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
2303 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
2304 CResult_NoneChannelMonitorUpdateErrZ {
2305 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2306 err: Box::into_raw(Box::new(e)),
2312 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
2313 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
2314 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
2315 fn drop(&mut self) {
2318 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2319 let _ = unsafe { Box::from_raw(self.contents.err) };
2324 impl From<crate::c_types::CResultTempl<u8, crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
2325 fn from(mut o: crate::c_types::CResultTempl<u8, crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr>) -> Self {
2326 let contents = if o.result_ok {
2327 let _ = unsafe { Box::from_raw(o.contents.result) };
2328 o.contents.result = std::ptr::null_mut();
2329 CResult_NoneChannelMonitorUpdateErrZPtr { result: std::ptr::null_mut() }
2331 let err = unsafe { o.contents.err };
2332 unsafe { o.contents.err = std::ptr::null_mut(); }
2333 CResult_NoneChannelMonitorUpdateErrZPtr { err }
2337 result_ok: o.result_ok,
2341 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
2342 fn clone(&self) -> Self {
2344 Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2345 result: std::ptr::null_mut()
2348 Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2349 err: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
2355 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
2356 /// but with all dynamically-allocated buffers duplicated in new buffers.
2357 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { orig.clone() }
2359 /// A tuple of 2 elements. See the individual fields for the types contained.
2360 pub struct C2Tuple_BlockHashChannelMonitorZ {
2361 /// The element at position 0
2362 pub a: crate::c_types::ThirtyTwoBytes,
2363 /// The element at position 1
2364 pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
2366 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
2367 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
2374 impl C2Tuple_BlockHashChannelMonitorZ {
2375 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
2379 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
2381 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
2382 C2Tuple_BlockHashChannelMonitorZ { a, b, }
2386 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
2387 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
2389 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
2390 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
2391 /// A pointer to the contents in the success state.
2392 /// Reading from this pointer when `result_ok` is not set is undefined.
2393 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
2394 /// A pointer to the contents in the error state.
2395 /// Reading from this pointer when `result_ok` is set is undefined.
2396 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2399 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
2400 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
2401 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2402 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
2403 /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
2404 /// `err` or `result` depending on the state of `result_ok`.
2405 pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
2406 /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
2407 pub result_ok: bool,
2410 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
2411 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
2412 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
2413 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
2414 result: Box::into_raw(Box::new(o)),
2420 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
2421 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
2422 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
2423 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
2424 err: Box::into_raw(Box::new(e)),
2430 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
2431 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
2432 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
2433 fn drop(&mut self) {
2435 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2436 let _ = unsafe { Box::from_raw(self.contents.result) };
2439 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2440 let _ = unsafe { Box::from_raw(self.contents.err) };
2445 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
2446 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
2447 let contents = if o.result_ok {
2448 let result = unsafe { o.contents.result };
2449 unsafe { o.contents.result = std::ptr::null_mut() };
2450 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
2452 let err = unsafe { o.contents.err };
2453 unsafe { o.contents.err = std::ptr::null_mut(); }
2454 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
2458 result_ok: o.result_ok,
2463 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
2464 /// This corresponds to std::vector in C++
2465 pub struct CVec_RouteHopZ {
2466 /// The elements in the array.
2467 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2468 pub data: *mut crate::lightning::routing::router::RouteHop,
2469 /// The number of elements pointed to by `data`.
2472 impl CVec_RouteHopZ {
2473 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
2474 if self.datalen == 0 { return Vec::new(); }
2475 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2476 self.data = std::ptr::null_mut();
2480 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
2481 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2484 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
2485 fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
2486 let datalen = v.len();
2487 let data = Box::into_raw(v.into_boxed_slice());
2488 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2492 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2493 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
2494 impl Drop for CVec_RouteHopZ {
2495 fn drop(&mut self) {
2496 if self.datalen == 0 { return; }
2497 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2500 impl Clone for CVec_RouteHopZ {
2501 fn clone(&self) -> Self {
2502 let mut res = Vec::new();
2503 if self.datalen == 0 { return Self::from(res); }
2504 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2509 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
2510 /// This corresponds to std::vector in C++
2511 pub struct CVec_CVec_RouteHopZZ {
2512 /// The elements in the array.
2513 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2514 pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
2515 /// The number of elements pointed to by `data`.
2518 impl CVec_CVec_RouteHopZZ {
2519 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
2520 if self.datalen == 0 { return Vec::new(); }
2521 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2522 self.data = std::ptr::null_mut();
2526 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
2527 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2530 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
2531 fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
2532 let datalen = v.len();
2533 let data = Box::into_raw(v.into_boxed_slice());
2534 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2538 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2539 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
2540 impl Drop for CVec_CVec_RouteHopZZ {
2541 fn drop(&mut self) {
2542 if self.datalen == 0 { return; }
2543 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2546 impl Clone for CVec_CVec_RouteHopZZ {
2547 fn clone(&self) -> Self {
2548 let mut res = Vec::new();
2549 if self.datalen == 0 { return Self::from(res); }
2550 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2555 /// The contents of CResult_RouteDecodeErrorZ
2556 pub union CResult_RouteDecodeErrorZPtr {
2557 /// A pointer to the contents in the success state.
2558 /// Reading from this pointer when `result_ok` is not set is undefined.
2559 pub result: *mut crate::lightning::routing::router::Route,
2560 /// A pointer to the contents in the error state.
2561 /// Reading from this pointer when `result_ok` is set is undefined.
2562 pub err: *mut crate::lightning::ln::msgs::DecodeError,
2565 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
2566 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
2567 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2568 pub struct CResult_RouteDecodeErrorZ {
2569 /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
2570 /// `err` or `result` depending on the state of `result_ok`.
2571 pub contents: CResult_RouteDecodeErrorZPtr,
2572 /// Whether this CResult_RouteDecodeErrorZ represents a success state.
2573 pub result_ok: bool,
2576 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
2577 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
2578 CResult_RouteDecodeErrorZ {
2579 contents: CResult_RouteDecodeErrorZPtr {
2580 result: Box::into_raw(Box::new(o)),
2586 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
2587 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
2588 CResult_RouteDecodeErrorZ {
2589 contents: CResult_RouteDecodeErrorZPtr {
2590 err: Box::into_raw(Box::new(e)),
2596 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
2597 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
2598 impl Drop for CResult_RouteDecodeErrorZ {
2599 fn drop(&mut self) {
2601 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2602 let _ = unsafe { Box::from_raw(self.contents.result) };
2605 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2606 let _ = unsafe { Box::from_raw(self.contents.err) };
2611 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
2612 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
2613 let contents = if o.result_ok {
2614 let result = unsafe { o.contents.result };
2615 unsafe { o.contents.result = std::ptr::null_mut() };
2616 CResult_RouteDecodeErrorZPtr { result }
2618 let err = unsafe { o.contents.err };
2619 unsafe { o.contents.err = std::ptr::null_mut(); }
2620 CResult_RouteDecodeErrorZPtr { err }
2624 result_ok: o.result_ok,
2628 impl Clone for CResult_RouteDecodeErrorZ {
2629 fn clone(&self) -> Self {
2631 Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
2632 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2635 Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
2636 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2642 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
2643 /// but with all dynamically-allocated buffers duplicated in new buffers.
2644 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { orig.clone() }
2647 /// An enum which can either contain a u64 or not
2648 pub enum COption_u64Z {
2649 /// When we're in this state, this COption_u64Z contains a u64
2651 /// When we're in this state, this COption_u64Z contains nothing
2655 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2656 if let Self::Some(_) = self { true } else { false }
2658 #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
2659 if let Self::Some(v) = self { v } else { unreachable!() }
2663 /// Constructs a new COption_u64Z containing a u64
2664 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
2665 COption_u64Z::Some(o)
2668 /// Constructs a new COption_u64Z containing nothing
2669 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
2673 /// Frees any resources associated with the u64, if we are in the Some state
2674 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
2676 /// Creates a new COption_u64Z which has the same data as `orig`
2677 /// but with all dynamically-allocated buffers duplicated in new buffers.
2678 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { orig.clone() }
2680 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2681 /// This corresponds to std::vector in C++
2682 pub struct CVec_ChannelDetailsZ {
2683 /// The elements in the array.
2684 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2685 pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
2686 /// The number of elements pointed to by `data`.
2689 impl CVec_ChannelDetailsZ {
2690 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
2691 if self.datalen == 0 { return Vec::new(); }
2692 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2693 self.data = std::ptr::null_mut();
2697 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
2698 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2701 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
2702 fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
2703 let datalen = v.len();
2704 let data = Box::into_raw(v.into_boxed_slice());
2705 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2709 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2710 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
2711 impl Drop for CVec_ChannelDetailsZ {
2712 fn drop(&mut self) {
2713 if self.datalen == 0 { return; }
2714 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2717 impl Clone for CVec_ChannelDetailsZ {
2718 fn clone(&self) -> Self {
2719 let mut res = Vec::new();
2720 if self.datalen == 0 { return Self::from(res); }
2721 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2726 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2727 /// This corresponds to std::vector in C++
2728 pub struct CVec_RouteHintHopZ {
2729 /// The elements in the array.
2730 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2731 pub data: *mut crate::lightning::routing::router::RouteHintHop,
2732 /// The number of elements pointed to by `data`.
2735 impl CVec_RouteHintHopZ {
2736 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
2737 if self.datalen == 0 { return Vec::new(); }
2738 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2739 self.data = std::ptr::null_mut();
2743 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
2744 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2747 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
2748 fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
2749 let datalen = v.len();
2750 let data = Box::into_raw(v.into_boxed_slice());
2751 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2755 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2756 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
2757 impl Drop for CVec_RouteHintHopZ {
2758 fn drop(&mut self) {
2759 if self.datalen == 0 { return; }
2760 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2763 impl Clone for CVec_RouteHintHopZ {
2764 fn clone(&self) -> Self {
2765 let mut res = Vec::new();
2766 if self.datalen == 0 { return Self::from(res); }
2767 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2772 /// The contents of CResult_RouteLightningErrorZ
2773 pub union CResult_RouteLightningErrorZPtr {
2774 /// A pointer to the contents in the success state.
2775 /// Reading from this pointer when `result_ok` is not set is undefined.
2776 pub result: *mut crate::lightning::routing::router::Route,
2777 /// A pointer to the contents in the error state.
2778 /// Reading from this pointer when `result_ok` is set is undefined.
2779 pub err: *mut crate::lightning::ln::msgs::LightningError,
2782 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2783 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2784 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2785 pub struct CResult_RouteLightningErrorZ {
2786 /// The contents of this CResult_RouteLightningErrorZ, accessible via either
2787 /// `err` or `result` depending on the state of `result_ok`.
2788 pub contents: CResult_RouteLightningErrorZPtr,
2789 /// Whether this CResult_RouteLightningErrorZ represents a success state.
2790 pub result_ok: bool,
2793 /// Creates a new CResult_RouteLightningErrorZ in the success state.
2794 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
2795 CResult_RouteLightningErrorZ {
2796 contents: CResult_RouteLightningErrorZPtr {
2797 result: Box::into_raw(Box::new(o)),
2803 /// Creates a new CResult_RouteLightningErrorZ in the error state.
2804 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
2805 CResult_RouteLightningErrorZ {
2806 contents: CResult_RouteLightningErrorZPtr {
2807 err: Box::into_raw(Box::new(e)),
2813 /// Frees any resources used by the CResult_RouteLightningErrorZ.
2814 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
2815 impl Drop for CResult_RouteLightningErrorZ {
2816 fn drop(&mut self) {
2818 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2819 let _ = unsafe { Box::from_raw(self.contents.result) };
2822 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2823 let _ = unsafe { Box::from_raw(self.contents.err) };
2828 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2829 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2830 let contents = if o.result_ok {
2831 let result = unsafe { o.contents.result };
2832 unsafe { o.contents.result = std::ptr::null_mut() };
2833 CResult_RouteLightningErrorZPtr { result }
2835 let err = unsafe { o.contents.err };
2836 unsafe { o.contents.err = std::ptr::null_mut(); }
2837 CResult_RouteLightningErrorZPtr { err }
2841 result_ok: o.result_ok,
2845 impl Clone for CResult_RouteLightningErrorZ {
2846 fn clone(&self) -> Self {
2848 Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2849 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2852 Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2853 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2859 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2860 /// but with all dynamically-allocated buffers duplicated in new buffers.
2861 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { orig.clone() }
2863 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
2864 /// This corresponds to std::vector in C++
2865 pub struct CVec_MessageSendEventZ {
2866 /// The elements in the array.
2867 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2868 pub data: *mut crate::lightning::util::events::MessageSendEvent,
2869 /// The number of elements pointed to by `data`.
2872 impl CVec_MessageSendEventZ {
2873 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
2874 if self.datalen == 0 { return Vec::new(); }
2875 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2876 self.data = std::ptr::null_mut();
2880 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
2881 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2884 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
2885 fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
2886 let datalen = v.len();
2887 let data = Box::into_raw(v.into_boxed_slice());
2888 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2892 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2893 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
2894 impl Drop for CVec_MessageSendEventZ {
2895 fn drop(&mut self) {
2896 if self.datalen == 0 { return; }
2897 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2900 impl Clone for CVec_MessageSendEventZ {
2901 fn clone(&self) -> Self {
2902 let mut res = Vec::new();
2903 if self.datalen == 0 { return Self::from(res); }
2904 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2909 /// The contents of CResult_boolLightningErrorZ
2910 pub union CResult_boolLightningErrorZPtr {
2911 /// A pointer to the contents in the success state.
2912 /// Reading from this pointer when `result_ok` is not set is undefined.
2913 pub result: *mut bool,
2914 /// A pointer to the contents in the error state.
2915 /// Reading from this pointer when `result_ok` is set is undefined.
2916 pub err: *mut crate::lightning::ln::msgs::LightningError,
2919 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
2920 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
2921 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2922 pub struct CResult_boolLightningErrorZ {
2923 /// The contents of this CResult_boolLightningErrorZ, accessible via either
2924 /// `err` or `result` depending on the state of `result_ok`.
2925 pub contents: CResult_boolLightningErrorZPtr,
2926 /// Whether this CResult_boolLightningErrorZ represents a success state.
2927 pub result_ok: bool,
2930 /// Creates a new CResult_boolLightningErrorZ in the success state.
2931 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
2932 CResult_boolLightningErrorZ {
2933 contents: CResult_boolLightningErrorZPtr {
2934 result: Box::into_raw(Box::new(o)),
2940 /// Creates a new CResult_boolLightningErrorZ in the error state.
2941 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
2942 CResult_boolLightningErrorZ {
2943 contents: CResult_boolLightningErrorZPtr {
2944 err: Box::into_raw(Box::new(e)),
2950 /// Frees any resources used by the CResult_boolLightningErrorZ.
2951 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
2952 impl Drop for CResult_boolLightningErrorZ {
2953 fn drop(&mut self) {
2955 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2956 let _ = unsafe { Box::from_raw(self.contents.result) };
2959 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2960 let _ = unsafe { Box::from_raw(self.contents.err) };
2965 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
2966 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
2967 let contents = if o.result_ok {
2968 let result = unsafe { o.contents.result };
2969 unsafe { o.contents.result = std::ptr::null_mut() };
2970 CResult_boolLightningErrorZPtr { result }
2972 let err = unsafe { o.contents.err };
2973 unsafe { o.contents.err = std::ptr::null_mut(); }
2974 CResult_boolLightningErrorZPtr { err }
2978 result_ok: o.result_ok,
2982 impl Clone for CResult_boolLightningErrorZ {
2983 fn clone(&self) -> Self {
2985 Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
2986 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
2989 Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
2990 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2996 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
2997 /// but with all dynamically-allocated buffers duplicated in new buffers.
2998 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { orig.clone() }
3000 /// A tuple of 3 elements. See the individual fields for the types contained.
3001 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
3002 /// The element at position 0
3003 pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
3004 /// The element at position 1
3005 pub b: crate::lightning::ln::msgs::ChannelUpdate,
3006 /// The element at position 2
3007 pub c: crate::lightning::ln::msgs::ChannelUpdate,
3009 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
3010 fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
3018 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
3019 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
3020 (self.a, self.b, self.c)
3023 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
3024 fn clone(&self) -> Self {
3033 /// Creates a new tuple which has the same data as `orig`
3034 /// but with all dynamically-allocated buffers duplicated in new buffers.
3035 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { orig.clone() }
3036 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
3038 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 {
3039 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
3043 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
3044 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
3046 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
3047 /// This corresponds to std::vector in C++
3048 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
3049 /// The elements in the array.
3050 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3051 pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
3052 /// The number of elements pointed to by `data`.
3055 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
3056 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
3057 if self.datalen == 0 { return Vec::new(); }
3058 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3059 self.data = std::ptr::null_mut();
3063 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
3064 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3067 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
3068 fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
3069 let datalen = v.len();
3070 let data = Box::into_raw(v.into_boxed_slice());
3071 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3075 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3076 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
3077 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
3078 fn drop(&mut self) {
3079 if self.datalen == 0 { return; }
3080 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3083 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
3084 fn clone(&self) -> Self {
3085 let mut res = Vec::new();
3086 if self.datalen == 0 { return Self::from(res); }
3087 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3092 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
3093 /// This corresponds to std::vector in C++
3094 pub struct CVec_NodeAnnouncementZ {
3095 /// The elements in the array.
3096 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3097 pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
3098 /// The number of elements pointed to by `data`.
3101 impl CVec_NodeAnnouncementZ {
3102 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
3103 if self.datalen == 0 { return Vec::new(); }
3104 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3105 self.data = std::ptr::null_mut();
3109 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
3110 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3113 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
3114 fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
3115 let datalen = v.len();
3116 let data = Box::into_raw(v.into_boxed_slice());
3117 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3121 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3122 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
3123 impl Drop for CVec_NodeAnnouncementZ {
3124 fn drop(&mut self) {
3125 if self.datalen == 0 { return; }
3126 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3129 impl Clone for CVec_NodeAnnouncementZ {
3130 fn clone(&self) -> Self {
3131 let mut res = Vec::new();
3132 if self.datalen == 0 { return Self::from(res); }
3133 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3138 /// The contents of CResult_NoneLightningErrorZ
3139 pub union CResult_NoneLightningErrorZPtr {
3140 /// Note that this value is always NULL, as there are no contents in the OK variant
3141 pub result: *mut std::ffi::c_void,
3142 /// A pointer to the contents in the error state.
3143 /// Reading from this pointer when `result_ok` is set is undefined.
3144 pub err: *mut crate::lightning::ln::msgs::LightningError,
3147 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
3148 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
3149 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3150 pub struct CResult_NoneLightningErrorZ {
3151 /// The contents of this CResult_NoneLightningErrorZ, accessible via either
3152 /// `err` or `result` depending on the state of `result_ok`.
3153 pub contents: CResult_NoneLightningErrorZPtr,
3154 /// Whether this CResult_NoneLightningErrorZ represents a success state.
3155 pub result_ok: bool,
3158 /// Creates a new CResult_NoneLightningErrorZ in the success state.
3159 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
3160 CResult_NoneLightningErrorZ {
3161 contents: CResult_NoneLightningErrorZPtr {
3162 result: std::ptr::null_mut(),
3168 /// Creates a new CResult_NoneLightningErrorZ in the error state.
3169 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
3170 CResult_NoneLightningErrorZ {
3171 contents: CResult_NoneLightningErrorZPtr {
3172 err: Box::into_raw(Box::new(e)),
3178 /// Frees any resources used by the CResult_NoneLightningErrorZ.
3179 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
3180 impl Drop for CResult_NoneLightningErrorZ {
3181 fn drop(&mut self) {
3184 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3185 let _ = unsafe { Box::from_raw(self.contents.err) };
3190 impl From<crate::c_types::CResultTempl<u8, crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
3191 fn from(mut o: crate::c_types::CResultTempl<u8, crate::lightning::ln::msgs::LightningError>) -> Self {
3192 let contents = if o.result_ok {
3193 let _ = unsafe { Box::from_raw(o.contents.result) };
3194 o.contents.result = std::ptr::null_mut();
3195 CResult_NoneLightningErrorZPtr { result: std::ptr::null_mut() }
3197 let err = unsafe { o.contents.err };
3198 unsafe { o.contents.err = std::ptr::null_mut(); }
3199 CResult_NoneLightningErrorZPtr { err }
3203 result_ok: o.result_ok,
3207 impl Clone for CResult_NoneLightningErrorZ {
3208 fn clone(&self) -> Self {
3210 Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
3211 result: std::ptr::null_mut()
3214 Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
3215 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
3221 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
3222 /// but with all dynamically-allocated buffers duplicated in new buffers.
3223 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { orig.clone() }
3225 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
3226 /// This corresponds to std::vector in C++
3227 pub struct CVec_PublicKeyZ {
3228 /// The elements in the array.
3229 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3230 pub data: *mut crate::c_types::PublicKey,
3231 /// The number of elements pointed to by `data`.
3234 impl CVec_PublicKeyZ {
3235 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
3236 if self.datalen == 0 { return Vec::new(); }
3237 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3238 self.data = std::ptr::null_mut();
3242 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
3243 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3246 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
3247 fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
3248 let datalen = v.len();
3249 let data = Box::into_raw(v.into_boxed_slice());
3250 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3254 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3255 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
3256 impl Drop for CVec_PublicKeyZ {
3257 fn drop(&mut self) {
3258 if self.datalen == 0 { return; }
3259 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3263 /// A dynamically-allocated array of u8s of arbitrary size.
3264 /// This corresponds to std::vector in C++
3265 pub struct CVec_u8Z {
3266 /// The elements in the array.
3267 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3269 /// The number of elements pointed to by `data`.
3273 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
3274 if self.datalen == 0 { return Vec::new(); }
3275 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3276 self.data = std::ptr::null_mut();
3280 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
3281 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3284 impl From<Vec<u8>> for CVec_u8Z {
3285 fn from(v: Vec<u8>) -> Self {
3286 let datalen = v.len();
3287 let data = Box::into_raw(v.into_boxed_slice());
3288 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3292 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3293 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
3294 impl Drop for CVec_u8Z {
3295 fn drop(&mut self) {
3296 if self.datalen == 0 { return; }
3297 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3300 impl Clone for CVec_u8Z {
3301 fn clone(&self) -> Self {
3302 let mut res = Vec::new();
3303 if self.datalen == 0 { return Self::from(res); }
3304 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3309 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
3310 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
3311 /// A pointer to the contents in the success state.
3312 /// Reading from this pointer when `result_ok` is not set is undefined.
3313 pub result: *mut crate::c_types::derived::CVec_u8Z,
3314 /// A pointer to the contents in the error state.
3315 /// Reading from this pointer when `result_ok` is set is undefined.
3316 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
3319 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
3320 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
3321 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3322 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
3323 /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
3324 /// `err` or `result` depending on the state of `result_ok`.
3325 pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
3326 /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
3327 pub result_ok: bool,
3330 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
3331 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
3332 CResult_CVec_u8ZPeerHandleErrorZ {
3333 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
3334 result: Box::into_raw(Box::new(o)),
3340 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
3341 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
3342 CResult_CVec_u8ZPeerHandleErrorZ {
3343 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
3344 err: Box::into_raw(Box::new(e)),
3350 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
3351 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
3352 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
3353 fn drop(&mut self) {
3355 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3356 let _ = unsafe { Box::from_raw(self.contents.result) };
3359 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3360 let _ = unsafe { Box::from_raw(self.contents.err) };
3365 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
3366 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
3367 let contents = if o.result_ok {
3368 let result = unsafe { o.contents.result };
3369 unsafe { o.contents.result = std::ptr::null_mut() };
3370 CResult_CVec_u8ZPeerHandleErrorZPtr { result }
3372 let err = unsafe { o.contents.err };
3373 unsafe { o.contents.err = std::ptr::null_mut(); }
3374 CResult_CVec_u8ZPeerHandleErrorZPtr { err }
3378 result_ok: o.result_ok,
3382 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
3383 fn clone(&self) -> Self {
3385 Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
3386 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
3389 Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
3390 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
3396 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
3397 /// but with all dynamically-allocated buffers duplicated in new buffers.
3398 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { orig.clone() }
3400 /// The contents of CResult_NonePeerHandleErrorZ
3401 pub union CResult_NonePeerHandleErrorZPtr {
3402 /// Note that this value is always NULL, as there are no contents in the OK variant
3403 pub result: *mut std::ffi::c_void,
3404 /// A pointer to the contents in the error state.
3405 /// Reading from this pointer when `result_ok` is set is undefined.
3406 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
3409 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
3410 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
3411 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3412 pub struct CResult_NonePeerHandleErrorZ {
3413 /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
3414 /// `err` or `result` depending on the state of `result_ok`.
3415 pub contents: CResult_NonePeerHandleErrorZPtr,
3416 /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
3417 pub result_ok: bool,
3420 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
3421 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
3422 CResult_NonePeerHandleErrorZ {
3423 contents: CResult_NonePeerHandleErrorZPtr {
3424 result: std::ptr::null_mut(),
3430 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
3431 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
3432 CResult_NonePeerHandleErrorZ {
3433 contents: CResult_NonePeerHandleErrorZPtr {
3434 err: Box::into_raw(Box::new(e)),
3440 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
3441 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
3442 impl Drop for CResult_NonePeerHandleErrorZ {
3443 fn drop(&mut self) {
3446 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3447 let _ = unsafe { Box::from_raw(self.contents.err) };
3452 impl From<crate::c_types::CResultTempl<u8, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
3453 fn from(mut o: crate::c_types::CResultTempl<u8, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
3454 let contents = if o.result_ok {
3455 let _ = unsafe { Box::from_raw(o.contents.result) };
3456 o.contents.result = std::ptr::null_mut();
3457 CResult_NonePeerHandleErrorZPtr { result: std::ptr::null_mut() }
3459 let err = unsafe { o.contents.err };
3460 unsafe { o.contents.err = std::ptr::null_mut(); }
3461 CResult_NonePeerHandleErrorZPtr { err }
3465 result_ok: o.result_ok,
3469 impl Clone for CResult_NonePeerHandleErrorZ {
3470 fn clone(&self) -> Self {
3472 Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
3473 result: std::ptr::null_mut()
3476 Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
3477 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
3483 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
3484 /// but with all dynamically-allocated buffers duplicated in new buffers.
3485 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { orig.clone() }
3487 /// The contents of CResult_boolPeerHandleErrorZ
3488 pub union CResult_boolPeerHandleErrorZPtr {
3489 /// A pointer to the contents in the success state.
3490 /// Reading from this pointer when `result_ok` is not set is undefined.
3491 pub result: *mut bool,
3492 /// A pointer to the contents in the error state.
3493 /// Reading from this pointer when `result_ok` is set is undefined.
3494 pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
3497 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
3498 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
3499 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3500 pub struct CResult_boolPeerHandleErrorZ {
3501 /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
3502 /// `err` or `result` depending on the state of `result_ok`.
3503 pub contents: CResult_boolPeerHandleErrorZPtr,
3504 /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
3505 pub result_ok: bool,
3508 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
3509 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
3510 CResult_boolPeerHandleErrorZ {
3511 contents: CResult_boolPeerHandleErrorZPtr {
3512 result: Box::into_raw(Box::new(o)),
3518 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
3519 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
3520 CResult_boolPeerHandleErrorZ {
3521 contents: CResult_boolPeerHandleErrorZPtr {
3522 err: Box::into_raw(Box::new(e)),
3528 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
3529 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
3530 impl Drop for CResult_boolPeerHandleErrorZ {
3531 fn drop(&mut self) {
3533 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3534 let _ = unsafe { Box::from_raw(self.contents.result) };
3537 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3538 let _ = unsafe { Box::from_raw(self.contents.err) };
3543 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
3544 fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
3545 let contents = if o.result_ok {
3546 let result = unsafe { o.contents.result };
3547 unsafe { o.contents.result = std::ptr::null_mut() };
3548 CResult_boolPeerHandleErrorZPtr { result }
3550 let err = unsafe { o.contents.err };
3551 unsafe { o.contents.err = std::ptr::null_mut(); }
3552 CResult_boolPeerHandleErrorZPtr { err }
3556 result_ok: o.result_ok,
3560 impl Clone for CResult_boolPeerHandleErrorZ {
3561 fn clone(&self) -> Self {
3563 Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
3564 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
3567 Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
3568 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
3574 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
3575 /// but with all dynamically-allocated buffers duplicated in new buffers.
3576 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { orig.clone() }
3578 /// The contents of CResult_TxOutAccessErrorZ
3579 pub union CResult_TxOutAccessErrorZPtr {
3580 /// A pointer to the contents in the success state.
3581 /// Reading from this pointer when `result_ok` is not set is undefined.
3582 pub result: *mut crate::c_types::TxOut,
3583 /// A pointer to the contents in the error state.
3584 /// Reading from this pointer when `result_ok` is set is undefined.
3585 pub err: *mut crate::lightning::chain::AccessError,
3588 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
3589 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
3590 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3591 pub struct CResult_TxOutAccessErrorZ {
3592 /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
3593 /// `err` or `result` depending on the state of `result_ok`.
3594 pub contents: CResult_TxOutAccessErrorZPtr,
3595 /// Whether this CResult_TxOutAccessErrorZ represents a success state.
3596 pub result_ok: bool,
3599 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
3600 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
3601 CResult_TxOutAccessErrorZ {
3602 contents: CResult_TxOutAccessErrorZPtr {
3603 result: Box::into_raw(Box::new(o)),
3609 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
3610 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
3611 CResult_TxOutAccessErrorZ {
3612 contents: CResult_TxOutAccessErrorZPtr {
3613 err: Box::into_raw(Box::new(e)),
3619 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
3620 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
3621 impl Drop for CResult_TxOutAccessErrorZ {
3622 fn drop(&mut self) {
3624 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3625 let _ = unsafe { Box::from_raw(self.contents.result) };
3628 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3629 let _ = unsafe { Box::from_raw(self.contents.err) };
3634 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
3635 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
3636 let contents = if o.result_ok {
3637 let result = unsafe { o.contents.result };
3638 unsafe { o.contents.result = std::ptr::null_mut() };
3639 CResult_TxOutAccessErrorZPtr { result }
3641 let err = unsafe { o.contents.err };
3642 unsafe { o.contents.err = std::ptr::null_mut(); }
3643 CResult_TxOutAccessErrorZPtr { err }
3647 result_ok: o.result_ok,
3651 impl Clone for CResult_TxOutAccessErrorZ {
3652 fn clone(&self) -> Self {
3654 Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
3655 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
3658 Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
3659 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
3665 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
3666 /// but with all dynamically-allocated buffers duplicated in new buffers.
3667 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { orig.clone() }
3669 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
3670 pub enum COption_C2Tuple_usizeTransactionZZ {
3671 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
3672 Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
3673 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
3676 impl COption_C2Tuple_usizeTransactionZZ {
3677 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3678 if let Self::Some(_) = self { true } else { false }
3680 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
3681 if let Self::Some(v) = self { v } else { unreachable!() }
3685 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
3686 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
3687 COption_C2Tuple_usizeTransactionZZ::Some(o)
3690 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
3691 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
3692 COption_C2Tuple_usizeTransactionZZ::None
3695 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
3696 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
3698 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
3699 /// This corresponds to std::vector in C++
3700 pub struct CVec_SpendableOutputDescriptorZ {
3701 /// The elements in the array.
3702 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3703 pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3704 /// The number of elements pointed to by `data`.
3707 impl CVec_SpendableOutputDescriptorZ {
3708 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
3709 if self.datalen == 0 { return Vec::new(); }
3710 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3711 self.data = std::ptr::null_mut();
3715 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
3716 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3719 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
3720 fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
3721 let datalen = v.len();
3722 let data = Box::into_raw(v.into_boxed_slice());
3723 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3727 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3728 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
3729 impl Drop for CVec_SpendableOutputDescriptorZ {
3730 fn drop(&mut self) {
3731 if self.datalen == 0 { return; }
3732 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3735 impl Clone for CVec_SpendableOutputDescriptorZ {
3736 fn clone(&self) -> Self {
3737 let mut res = Vec::new();
3738 if self.datalen == 0 { return Self::from(res); }
3739 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3744 /// The contents of CResult_DirectionalChannelInfoDecodeErrorZ
3745 pub union CResult_DirectionalChannelInfoDecodeErrorZPtr {
3746 /// A pointer to the contents in the success state.
3747 /// Reading from this pointer when `result_ok` is not set is undefined.
3748 pub result: *mut crate::lightning::routing::network_graph::DirectionalChannelInfo,
3749 /// A pointer to the contents in the error state.
3750 /// Reading from this pointer when `result_ok` is set is undefined.
3751 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3754 /// A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
3755 /// containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
3756 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3757 pub struct CResult_DirectionalChannelInfoDecodeErrorZ {
3758 /// The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
3759 /// `err` or `result` depending on the state of `result_ok`.
3760 pub contents: CResult_DirectionalChannelInfoDecodeErrorZPtr,
3761 /// Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
3762 pub result_ok: bool,
3765 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
3766 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::DirectionalChannelInfo) -> CResult_DirectionalChannelInfoDecodeErrorZ {
3767 CResult_DirectionalChannelInfoDecodeErrorZ {
3768 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
3769 result: Box::into_raw(Box::new(o)),
3775 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
3776 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DirectionalChannelInfoDecodeErrorZ {
3777 CResult_DirectionalChannelInfoDecodeErrorZ {
3778 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
3779 err: Box::into_raw(Box::new(e)),
3785 /// Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
3786 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_free(_res: CResult_DirectionalChannelInfoDecodeErrorZ) { }
3787 impl Drop for CResult_DirectionalChannelInfoDecodeErrorZ {
3788 fn drop(&mut self) {
3790 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3791 let _ = unsafe { Box::from_raw(self.contents.result) };
3794 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3795 let _ = unsafe { Box::from_raw(self.contents.err) };
3800 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_DirectionalChannelInfoDecodeErrorZ {
3801 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::DirectionalChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
3802 let contents = if o.result_ok {
3803 let result = unsafe { o.contents.result };
3804 unsafe { o.contents.result = std::ptr::null_mut() };
3805 CResult_DirectionalChannelInfoDecodeErrorZPtr { result }
3807 let err = unsafe { o.contents.err };
3808 unsafe { o.contents.err = std::ptr::null_mut(); }
3809 CResult_DirectionalChannelInfoDecodeErrorZPtr { err }
3813 result_ok: o.result_ok,
3817 impl Clone for CResult_DirectionalChannelInfoDecodeErrorZ {
3818 fn clone(&self) -> Self {
3820 Self { result_ok: true, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
3821 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::DirectionalChannelInfo>::clone(unsafe { &*self.contents.result })))
3824 Self { result_ok: false, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
3825 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3831 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
3832 /// but with all dynamically-allocated buffers duplicated in new buffers.
3833 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig: &CResult_DirectionalChannelInfoDecodeErrorZ) -> CResult_DirectionalChannelInfoDecodeErrorZ { orig.clone() }
3835 /// The contents of CResult_ChannelInfoDecodeErrorZ
3836 pub union CResult_ChannelInfoDecodeErrorZPtr {
3837 /// A pointer to the contents in the success state.
3838 /// Reading from this pointer when `result_ok` is not set is undefined.
3839 pub result: *mut crate::lightning::routing::network_graph::ChannelInfo,
3840 /// A pointer to the contents in the error state.
3841 /// Reading from this pointer when `result_ok` is set is undefined.
3842 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3845 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
3846 /// containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
3847 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3848 pub struct CResult_ChannelInfoDecodeErrorZ {
3849 /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
3850 /// `err` or `result` depending on the state of `result_ok`.
3851 pub contents: CResult_ChannelInfoDecodeErrorZPtr,
3852 /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
3853 pub result_ok: bool,
3856 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
3857 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
3858 CResult_ChannelInfoDecodeErrorZ {
3859 contents: CResult_ChannelInfoDecodeErrorZPtr {
3860 result: Box::into_raw(Box::new(o)),
3866 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
3867 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
3868 CResult_ChannelInfoDecodeErrorZ {
3869 contents: CResult_ChannelInfoDecodeErrorZPtr {
3870 err: Box::into_raw(Box::new(e)),
3876 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
3877 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
3878 impl Drop for CResult_ChannelInfoDecodeErrorZ {
3879 fn drop(&mut self) {
3881 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3882 let _ = unsafe { Box::from_raw(self.contents.result) };
3885 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3886 let _ = unsafe { Box::from_raw(self.contents.err) };
3891 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
3892 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
3893 let contents = if o.result_ok {
3894 let result = unsafe { o.contents.result };
3895 unsafe { o.contents.result = std::ptr::null_mut() };
3896 CResult_ChannelInfoDecodeErrorZPtr { result }
3898 let err = unsafe { o.contents.err };
3899 unsafe { o.contents.err = std::ptr::null_mut(); }
3900 CResult_ChannelInfoDecodeErrorZPtr { err }
3904 result_ok: o.result_ok,
3908 impl Clone for CResult_ChannelInfoDecodeErrorZ {
3909 fn clone(&self) -> Self {
3911 Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
3912 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
3915 Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
3916 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3922 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
3923 /// but with all dynamically-allocated buffers duplicated in new buffers.
3924 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { orig.clone() }
3926 /// The contents of CResult_RoutingFeesDecodeErrorZ
3927 pub union CResult_RoutingFeesDecodeErrorZPtr {
3928 /// A pointer to the contents in the success state.
3929 /// Reading from this pointer when `result_ok` is not set is undefined.
3930 pub result: *mut crate::lightning::routing::network_graph::RoutingFees,
3931 /// A pointer to the contents in the error state.
3932 /// Reading from this pointer when `result_ok` is set is undefined.
3933 pub err: *mut crate::lightning::ln::msgs::DecodeError,
3936 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
3937 /// containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
3938 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3939 pub struct CResult_RoutingFeesDecodeErrorZ {
3940 /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
3941 /// `err` or `result` depending on the state of `result_ok`.
3942 pub contents: CResult_RoutingFeesDecodeErrorZPtr,
3943 /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
3944 pub result_ok: bool,
3947 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
3948 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
3949 CResult_RoutingFeesDecodeErrorZ {
3950 contents: CResult_RoutingFeesDecodeErrorZPtr {
3951 result: Box::into_raw(Box::new(o)),
3957 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
3958 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
3959 CResult_RoutingFeesDecodeErrorZ {
3960 contents: CResult_RoutingFeesDecodeErrorZPtr {
3961 err: Box::into_raw(Box::new(e)),
3967 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
3968 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
3969 impl Drop for CResult_RoutingFeesDecodeErrorZ {
3970 fn drop(&mut self) {
3972 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3973 let _ = unsafe { Box::from_raw(self.contents.result) };
3976 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3977 let _ = unsafe { Box::from_raw(self.contents.err) };
3982 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
3983 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
3984 let contents = if o.result_ok {
3985 let result = unsafe { o.contents.result };
3986 unsafe { o.contents.result = std::ptr::null_mut() };
3987 CResult_RoutingFeesDecodeErrorZPtr { result }
3989 let err = unsafe { o.contents.err };
3990 unsafe { o.contents.err = std::ptr::null_mut(); }
3991 CResult_RoutingFeesDecodeErrorZPtr { err }
3995 result_ok: o.result_ok,
3999 impl Clone for CResult_RoutingFeesDecodeErrorZ {
4000 fn clone(&self) -> Self {
4002 Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
4003 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
4006 Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
4007 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4013 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
4014 /// but with all dynamically-allocated buffers duplicated in new buffers.
4015 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { orig.clone() }
4017 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
4018 /// This corresponds to std::vector in C++
4019 pub struct CVec_NetAddressZ {
4020 /// The elements in the array.
4021 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4022 pub data: *mut crate::lightning::ln::msgs::NetAddress,
4023 /// The number of elements pointed to by `data`.
4026 impl CVec_NetAddressZ {
4027 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
4028 if self.datalen == 0 { return Vec::new(); }
4029 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4030 self.data = std::ptr::null_mut();
4034 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
4035 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4038 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
4039 fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
4040 let datalen = v.len();
4041 let data = Box::into_raw(v.into_boxed_slice());
4042 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4046 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4047 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
4048 impl Drop for CVec_NetAddressZ {
4049 fn drop(&mut self) {
4050 if self.datalen == 0 { return; }
4051 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4054 impl Clone for CVec_NetAddressZ {
4055 fn clone(&self) -> Self {
4056 let mut res = Vec::new();
4057 if self.datalen == 0 { return Self::from(res); }
4058 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4063 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
4064 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
4065 /// A pointer to the contents in the success state.
4066 /// Reading from this pointer when `result_ok` is not set is undefined.
4067 pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
4068 /// A pointer to the contents in the error state.
4069 /// Reading from this pointer when `result_ok` is set is undefined.
4070 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4073 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
4074 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4075 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4076 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
4077 /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
4078 /// `err` or `result` depending on the state of `result_ok`.
4079 pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
4080 /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
4081 pub result_ok: bool,
4084 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
4085 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
4086 CResult_NodeAnnouncementInfoDecodeErrorZ {
4087 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
4088 result: Box::into_raw(Box::new(o)),
4094 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
4095 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
4096 CResult_NodeAnnouncementInfoDecodeErrorZ {
4097 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
4098 err: Box::into_raw(Box::new(e)),
4104 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
4105 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
4106 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
4107 fn drop(&mut self) {
4109 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4110 let _ = unsafe { Box::from_raw(self.contents.result) };
4113 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4114 let _ = unsafe { Box::from_raw(self.contents.err) };
4119 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
4120 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
4121 let contents = if o.result_ok {
4122 let result = unsafe { o.contents.result };
4123 unsafe { o.contents.result = std::ptr::null_mut() };
4124 CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
4126 let err = unsafe { o.contents.err };
4127 unsafe { o.contents.err = std::ptr::null_mut(); }
4128 CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
4132 result_ok: o.result_ok,
4136 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
4137 fn clone(&self) -> Self {
4139 Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
4140 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
4143 Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
4144 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4150 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
4151 /// but with all dynamically-allocated buffers duplicated in new buffers.
4152 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { orig.clone() }
4154 /// A dynamically-allocated array of u64s of arbitrary size.
4155 /// This corresponds to std::vector in C++
4156 pub struct CVec_u64Z {
4157 /// The elements in the array.
4158 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4160 /// The number of elements pointed to by `data`.
4164 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
4165 if self.datalen == 0 { return Vec::new(); }
4166 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4167 self.data = std::ptr::null_mut();
4171 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
4172 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4175 impl From<Vec<u64>> for CVec_u64Z {
4176 fn from(v: Vec<u64>) -> Self {
4177 let datalen = v.len();
4178 let data = Box::into_raw(v.into_boxed_slice());
4179 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4183 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4184 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
4185 impl Drop for CVec_u64Z {
4186 fn drop(&mut self) {
4187 if self.datalen == 0 { return; }
4188 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4191 impl Clone for CVec_u64Z {
4192 fn clone(&self) -> Self {
4193 let mut res = Vec::new();
4194 if self.datalen == 0 { return Self::from(res); }
4195 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4200 /// The contents of CResult_NodeInfoDecodeErrorZ
4201 pub union CResult_NodeInfoDecodeErrorZPtr {
4202 /// A pointer to the contents in the success state.
4203 /// Reading from this pointer when `result_ok` is not set is undefined.
4204 pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
4205 /// A pointer to the contents in the error state.
4206 /// Reading from this pointer when `result_ok` is set is undefined.
4207 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4210 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
4211 /// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4212 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4213 pub struct CResult_NodeInfoDecodeErrorZ {
4214 /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
4215 /// `err` or `result` depending on the state of `result_ok`.
4216 pub contents: CResult_NodeInfoDecodeErrorZPtr,
4217 /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
4218 pub result_ok: bool,
4221 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
4222 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
4223 CResult_NodeInfoDecodeErrorZ {
4224 contents: CResult_NodeInfoDecodeErrorZPtr {
4225 result: Box::into_raw(Box::new(o)),
4231 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
4232 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
4233 CResult_NodeInfoDecodeErrorZ {
4234 contents: CResult_NodeInfoDecodeErrorZPtr {
4235 err: Box::into_raw(Box::new(e)),
4241 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
4242 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
4243 impl Drop for CResult_NodeInfoDecodeErrorZ {
4244 fn drop(&mut self) {
4246 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4247 let _ = unsafe { Box::from_raw(self.contents.result) };
4250 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4251 let _ = unsafe { Box::from_raw(self.contents.err) };
4256 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
4257 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
4258 let contents = if o.result_ok {
4259 let result = unsafe { o.contents.result };
4260 unsafe { o.contents.result = std::ptr::null_mut() };
4261 CResult_NodeInfoDecodeErrorZPtr { result }
4263 let err = unsafe { o.contents.err };
4264 unsafe { o.contents.err = std::ptr::null_mut(); }
4265 CResult_NodeInfoDecodeErrorZPtr { err }
4269 result_ok: o.result_ok,
4273 impl Clone for CResult_NodeInfoDecodeErrorZ {
4274 fn clone(&self) -> Self {
4276 Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
4277 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
4280 Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
4281 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4287 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
4288 /// but with all dynamically-allocated buffers duplicated in new buffers.
4289 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { orig.clone() }
4291 /// The contents of CResult_NetworkGraphDecodeErrorZ
4292 pub union CResult_NetworkGraphDecodeErrorZPtr {
4293 /// A pointer to the contents in the success state.
4294 /// Reading from this pointer when `result_ok` is not set is undefined.
4295 pub result: *mut crate::lightning::routing::network_graph::NetworkGraph,
4296 /// A pointer to the contents in the error state.
4297 /// Reading from this pointer when `result_ok` is set is undefined.
4298 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4301 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
4302 /// containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
4303 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4304 pub struct CResult_NetworkGraphDecodeErrorZ {
4305 /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
4306 /// `err` or `result` depending on the state of `result_ok`.
4307 pub contents: CResult_NetworkGraphDecodeErrorZPtr,
4308 /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
4309 pub result_ok: bool,
4312 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
4313 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
4314 CResult_NetworkGraphDecodeErrorZ {
4315 contents: CResult_NetworkGraphDecodeErrorZPtr {
4316 result: Box::into_raw(Box::new(o)),
4322 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
4323 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
4324 CResult_NetworkGraphDecodeErrorZ {
4325 contents: CResult_NetworkGraphDecodeErrorZPtr {
4326 err: Box::into_raw(Box::new(e)),
4332 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
4333 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
4334 impl Drop for CResult_NetworkGraphDecodeErrorZ {
4335 fn drop(&mut self) {
4337 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4338 let _ = unsafe { Box::from_raw(self.contents.result) };
4341 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4342 let _ = unsafe { Box::from_raw(self.contents.err) };
4347 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
4348 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
4349 let contents = if o.result_ok {
4350 let result = unsafe { o.contents.result };
4351 unsafe { o.contents.result = std::ptr::null_mut() };
4352 CResult_NetworkGraphDecodeErrorZPtr { result }
4354 let err = unsafe { o.contents.err };
4355 unsafe { o.contents.err = std::ptr::null_mut(); }
4356 CResult_NetworkGraphDecodeErrorZPtr { err }
4360 result_ok: o.result_ok,
4364 impl Clone for CResult_NetworkGraphDecodeErrorZ {
4365 fn clone(&self) -> Self {
4367 Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
4368 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
4371 Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
4372 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4378 /// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
4379 /// but with all dynamically-allocated buffers duplicated in new buffers.
4380 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { orig.clone() }
4382 /// The contents of CResult_InitFeaturesDecodeErrorZ
4383 pub union CResult_InitFeaturesDecodeErrorZPtr {
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::InitFeatures,
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_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4393 /// containing a crate::lightning::ln::features::InitFeatures 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_InitFeaturesDecodeErrorZ {
4396 /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4397 /// `err` or `result` depending on the state of `result_ok`.
4398 pub contents: CResult_InitFeaturesDecodeErrorZPtr,
4399 /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4400 pub result_ok: bool,
4403 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
4404 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
4405 CResult_InitFeaturesDecodeErrorZ {
4406 contents: CResult_InitFeaturesDecodeErrorZPtr {
4407 result: Box::into_raw(Box::new(o)),
4413 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
4414 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
4415 CResult_InitFeaturesDecodeErrorZ {
4416 contents: CResult_InitFeaturesDecodeErrorZPtr {
4417 err: Box::into_raw(Box::new(e)),
4423 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
4424 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
4425 impl Drop for CResult_InitFeaturesDecodeErrorZ {
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::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
4439 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, 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_InitFeaturesDecodeErrorZPtr { result }
4445 let err = unsafe { o.contents.err };
4446 unsafe { o.contents.err = std::ptr::null_mut(); }
4447 CResult_InitFeaturesDecodeErrorZPtr { err }
4451 result_ok: o.result_ok,
4456 /// The contents of CResult_NodeFeaturesDecodeErrorZ
4457 pub union CResult_NodeFeaturesDecodeErrorZPtr {
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::NodeFeatures,
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_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4467 /// containing a crate::lightning::ln::features::NodeFeatures 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_NodeFeaturesDecodeErrorZ {
4470 /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4471 /// `err` or `result` depending on the state of `result_ok`.
4472 pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
4473 /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4474 pub result_ok: bool,
4477 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
4478 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
4479 CResult_NodeFeaturesDecodeErrorZ {
4480 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4481 result: Box::into_raw(Box::new(o)),
4487 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
4488 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
4489 CResult_NodeFeaturesDecodeErrorZ {
4490 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4491 err: Box::into_raw(Box::new(e)),
4497 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
4498 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
4499 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
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::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
4513 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, 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_NodeFeaturesDecodeErrorZPtr { result }
4519 let err = unsafe { o.contents.err };
4520 unsafe { o.contents.err = std::ptr::null_mut(); }
4521 CResult_NodeFeaturesDecodeErrorZPtr { err }
4525 result_ok: o.result_ok,
4530 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
4531 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
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::ChannelFeatures,
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_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4541 /// containing a crate::lightning::ln::features::ChannelFeatures 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_ChannelFeaturesDecodeErrorZ {
4544 /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4545 /// `err` or `result` depending on the state of `result_ok`.
4546 pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
4547 /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4548 pub result_ok: bool,
4551 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
4552 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
4553 CResult_ChannelFeaturesDecodeErrorZ {
4554 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4555 result: Box::into_raw(Box::new(o)),
4561 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
4562 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
4563 CResult_ChannelFeaturesDecodeErrorZ {
4564 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4565 err: Box::into_raw(Box::new(e)),
4571 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
4572 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
4573 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
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::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
4587 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, 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_ChannelFeaturesDecodeErrorZPtr { result }
4593 let err = unsafe { o.contents.err };
4594 unsafe { o.contents.err = std::ptr::null_mut(); }
4595 CResult_ChannelFeaturesDecodeErrorZPtr { err }
4599 result_ok: o.result_ok,
4604 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
4605 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
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::features::InvoiceFeatures,
4609 /// A pointer to the contents in the error state.
4610 /// Reading from this pointer when `result_ok` is set is undefined.
4611 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4614 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4615 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4616 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4617 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
4618 /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4619 /// `err` or `result` depending on the state of `result_ok`.
4620 pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
4621 /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4622 pub result_ok: bool,
4625 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
4626 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
4627 CResult_InvoiceFeaturesDecodeErrorZ {
4628 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4629 result: Box::into_raw(Box::new(o)),
4635 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
4636 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
4637 CResult_InvoiceFeaturesDecodeErrorZ {
4638 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4639 err: Box::into_raw(Box::new(e)),
4645 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
4646 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
4647 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
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::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
4661 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> 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_InvoiceFeaturesDecodeErrorZPtr { result }
4667 let err = unsafe { o.contents.err };
4668 unsafe { o.contents.err = std::ptr::null_mut(); }
4669 CResult_InvoiceFeaturesDecodeErrorZPtr { err }
4673 result_ok: o.result_ok,
4678 /// The contents of CResult_NetAddressu8Z
4679 pub union CResult_NetAddressu8ZPtr {
4680 /// A pointer to the contents in the success state.
4681 /// Reading from this pointer when `result_ok` is not set is undefined.
4682 pub result: *mut crate::lightning::ln::msgs::NetAddress,
4683 /// A pointer to the contents in the error state.
4684 /// Reading from this pointer when `result_ok` is set is undefined.
4688 /// A CResult_NetAddressu8Z represents the result of a fallible operation,
4689 /// containing a crate::lightning::ln::msgs::NetAddress on success and a u8 on failure.
4690 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4691 pub struct CResult_NetAddressu8Z {
4692 /// The contents of this CResult_NetAddressu8Z, accessible via either
4693 /// `err` or `result` depending on the state of `result_ok`.
4694 pub contents: CResult_NetAddressu8ZPtr,
4695 /// Whether this CResult_NetAddressu8Z represents a success state.
4696 pub result_ok: bool,
4699 /// Creates a new CResult_NetAddressu8Z in the success state.
4700 pub extern "C" fn CResult_NetAddressu8Z_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressu8Z {
4701 CResult_NetAddressu8Z {
4702 contents: CResult_NetAddressu8ZPtr {
4703 result: Box::into_raw(Box::new(o)),
4709 /// Creates a new CResult_NetAddressu8Z in the error state.
4710 pub extern "C" fn CResult_NetAddressu8Z_err(e: u8) -> CResult_NetAddressu8Z {
4711 CResult_NetAddressu8Z {
4712 contents: CResult_NetAddressu8ZPtr {
4713 err: Box::into_raw(Box::new(e)),
4719 /// Frees any resources used by the CResult_NetAddressu8Z.
4720 pub extern "C" fn CResult_NetAddressu8Z_free(_res: CResult_NetAddressu8Z) { }
4721 impl Drop for CResult_NetAddressu8Z {
4722 fn drop(&mut self) {
4724 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4725 let _ = unsafe { Box::from_raw(self.contents.result) };
4728 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4729 let _ = unsafe { Box::from_raw(self.contents.err) };
4734 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>> for CResult_NetAddressu8Z {
4735 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, u8>) -> Self {
4736 let contents = if o.result_ok {
4737 let result = unsafe { o.contents.result };
4738 unsafe { o.contents.result = std::ptr::null_mut() };
4739 CResult_NetAddressu8ZPtr { result }
4741 let err = unsafe { o.contents.err };
4742 unsafe { o.contents.err = std::ptr::null_mut(); }
4743 CResult_NetAddressu8ZPtr { err }
4747 result_ok: o.result_ok,
4751 impl Clone for CResult_NetAddressu8Z {
4752 fn clone(&self) -> Self {
4754 Self { result_ok: true, contents: CResult_NetAddressu8ZPtr {
4755 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
4758 Self { result_ok: false, contents: CResult_NetAddressu8ZPtr {
4759 err: Box::into_raw(Box::new(<u8>::clone(unsafe { &*self.contents.err })))
4765 /// Creates a new CResult_NetAddressu8Z which has the same data as `orig`
4766 /// but with all dynamically-allocated buffers duplicated in new buffers.
4767 pub extern "C" fn CResult_NetAddressu8Z_clone(orig: &CResult_NetAddressu8Z) -> CResult_NetAddressu8Z { orig.clone() }
4769 /// The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
4770 pub union CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
4771 /// A pointer to the contents in the success state.
4772 /// Reading from this pointer when `result_ok` is not set is undefined.
4773 pub result: *mut crate::c_types::derived::CResult_NetAddressu8Z,
4774 /// A pointer to the contents in the error state.
4775 /// Reading from this pointer when `result_ok` is set is undefined.
4776 pub err: *mut crate::lightning::ln::msgs::DecodeError,
4779 /// A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
4780 /// containing a crate::c_types::derived::CResult_NetAddressu8Z on success and a crate::lightning::ln::msgs::DecodeError on failure.
4781 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4782 pub struct CResult_CResult_NetAddressu8ZDecodeErrorZ {
4783 /// The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
4784 /// `err` or `result` depending on the state of `result_ok`.
4785 pub contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr,
4786 /// Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
4787 pub result_ok: bool,
4790 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
4791 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o: crate::c_types::derived::CResult_NetAddressu8Z) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
4792 CResult_CResult_NetAddressu8ZDecodeErrorZ {
4793 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
4794 result: Box::into_raw(Box::new(o)),
4800 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
4801 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
4802 CResult_CResult_NetAddressu8ZDecodeErrorZ {
4803 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
4804 err: Box::into_raw(Box::new(e)),
4810 /// Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
4811 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res: CResult_CResult_NetAddressu8ZDecodeErrorZ) { }
4812 impl Drop for CResult_CResult_NetAddressu8ZDecodeErrorZ {
4813 fn drop(&mut self) {
4815 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4816 let _ = unsafe { Box::from_raw(self.contents.result) };
4819 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4820 let _ = unsafe { Box::from_raw(self.contents.err) };
4825 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>> for CResult_CResult_NetAddressu8ZDecodeErrorZ {
4826 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::lightning::ln::msgs::DecodeError>) -> Self {
4827 let contents = if o.result_ok {
4828 let result = unsafe { o.contents.result };
4829 unsafe { o.contents.result = std::ptr::null_mut() };
4830 CResult_CResult_NetAddressu8ZDecodeErrorZPtr { result }
4832 let err = unsafe { o.contents.err };
4833 unsafe { o.contents.err = std::ptr::null_mut(); }
4834 CResult_CResult_NetAddressu8ZDecodeErrorZPtr { err }
4838 result_ok: o.result_ok,
4842 impl Clone for CResult_CResult_NetAddressu8ZDecodeErrorZ {
4843 fn clone(&self) -> Self {
4845 Self { result_ok: true, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
4846 result: Box::into_raw(Box::new(<crate::c_types::derived::CResult_NetAddressu8Z>::clone(unsafe { &*self.contents.result })))
4849 Self { result_ok: false, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
4850 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4856 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
4857 /// but with all dynamically-allocated buffers duplicated in new buffers.
4858 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig: &CResult_CResult_NetAddressu8ZDecodeErrorZ) -> CResult_CResult_NetAddressu8ZDecodeErrorZ { orig.clone() }
4860 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
4861 /// This corresponds to std::vector in C++
4862 pub struct CVec_UpdateAddHTLCZ {
4863 /// The elements in the array.
4864 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4865 pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
4866 /// The number of elements pointed to by `data`.
4869 impl CVec_UpdateAddHTLCZ {
4870 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
4871 if self.datalen == 0 { return Vec::new(); }
4872 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4873 self.data = std::ptr::null_mut();
4877 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
4878 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4881 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
4882 fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
4883 let datalen = v.len();
4884 let data = Box::into_raw(v.into_boxed_slice());
4885 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4889 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4890 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
4891 impl Drop for CVec_UpdateAddHTLCZ {
4892 fn drop(&mut self) {
4893 if self.datalen == 0 { return; }
4894 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4897 impl Clone for CVec_UpdateAddHTLCZ {
4898 fn clone(&self) -> Self {
4899 let mut res = Vec::new();
4900 if self.datalen == 0 { return Self::from(res); }
4901 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4906 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
4907 /// This corresponds to std::vector in C++
4908 pub struct CVec_UpdateFulfillHTLCZ {
4909 /// The elements in the array.
4910 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4911 pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
4912 /// The number of elements pointed to by `data`.
4915 impl CVec_UpdateFulfillHTLCZ {
4916 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
4917 if self.datalen == 0 { return Vec::new(); }
4918 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4919 self.data = std::ptr::null_mut();
4923 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
4924 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4927 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
4928 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
4929 let datalen = v.len();
4930 let data = Box::into_raw(v.into_boxed_slice());
4931 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4935 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4936 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
4937 impl Drop for CVec_UpdateFulfillHTLCZ {
4938 fn drop(&mut self) {
4939 if self.datalen == 0 { return; }
4940 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4943 impl Clone for CVec_UpdateFulfillHTLCZ {
4944 fn clone(&self) -> Self {
4945 let mut res = Vec::new();
4946 if self.datalen == 0 { return Self::from(res); }
4947 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4952 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
4953 /// This corresponds to std::vector in C++
4954 pub struct CVec_UpdateFailHTLCZ {
4955 /// The elements in the array.
4956 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4957 pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
4958 /// The number of elements pointed to by `data`.
4961 impl CVec_UpdateFailHTLCZ {
4962 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
4963 if self.datalen == 0 { return Vec::new(); }
4964 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4965 self.data = std::ptr::null_mut();
4969 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
4970 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4973 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
4974 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
4975 let datalen = v.len();
4976 let data = Box::into_raw(v.into_boxed_slice());
4977 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4981 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4982 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
4983 impl Drop for CVec_UpdateFailHTLCZ {
4984 fn drop(&mut self) {
4985 if self.datalen == 0 { return; }
4986 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4989 impl Clone for CVec_UpdateFailHTLCZ {
4990 fn clone(&self) -> Self {
4991 let mut res = Vec::new();
4992 if self.datalen == 0 { return Self::from(res); }
4993 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4998 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
4999 /// This corresponds to std::vector in C++
5000 pub struct CVec_UpdateFailMalformedHTLCZ {
5001 /// The elements in the array.
5002 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5003 pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
5004 /// The number of elements pointed to by `data`.
5007 impl CVec_UpdateFailMalformedHTLCZ {
5008 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
5009 if self.datalen == 0 { return Vec::new(); }
5010 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5011 self.data = std::ptr::null_mut();
5015 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
5016 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5019 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
5020 fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
5021 let datalen = v.len();
5022 let data = Box::into_raw(v.into_boxed_slice());
5023 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5027 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5028 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
5029 impl Drop for CVec_UpdateFailMalformedHTLCZ {
5030 fn drop(&mut self) {
5031 if self.datalen == 0 { return; }
5032 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5035 impl Clone for CVec_UpdateFailMalformedHTLCZ {
5036 fn clone(&self) -> Self {
5037 let mut res = Vec::new();
5038 if self.datalen == 0 { return Self::from(res); }
5039 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5044 /// The contents of CResult_AcceptChannelDecodeErrorZ
5045 pub union CResult_AcceptChannelDecodeErrorZPtr {
5046 /// A pointer to the contents in the success state.
5047 /// Reading from this pointer when `result_ok` is not set is undefined.
5048 pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
5049 /// A pointer to the contents in the error state.
5050 /// Reading from this pointer when `result_ok` is set is undefined.
5051 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5054 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
5055 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
5056 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5057 pub struct CResult_AcceptChannelDecodeErrorZ {
5058 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
5059 /// `err` or `result` depending on the state of `result_ok`.
5060 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
5061 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
5062 pub result_ok: bool,
5065 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
5066 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
5067 CResult_AcceptChannelDecodeErrorZ {
5068 contents: CResult_AcceptChannelDecodeErrorZPtr {
5069 result: Box::into_raw(Box::new(o)),
5075 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
5076 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
5077 CResult_AcceptChannelDecodeErrorZ {
5078 contents: CResult_AcceptChannelDecodeErrorZPtr {
5079 err: Box::into_raw(Box::new(e)),
5085 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
5086 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
5087 impl Drop for CResult_AcceptChannelDecodeErrorZ {
5088 fn drop(&mut self) {
5090 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5091 let _ = unsafe { Box::from_raw(self.contents.result) };
5094 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5095 let _ = unsafe { Box::from_raw(self.contents.err) };
5100 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
5101 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
5102 let contents = if o.result_ok {
5103 let result = unsafe { o.contents.result };
5104 unsafe { o.contents.result = std::ptr::null_mut() };
5105 CResult_AcceptChannelDecodeErrorZPtr { result }
5107 let err = unsafe { o.contents.err };
5108 unsafe { o.contents.err = std::ptr::null_mut(); }
5109 CResult_AcceptChannelDecodeErrorZPtr { err }
5113 result_ok: o.result_ok,
5117 impl Clone for CResult_AcceptChannelDecodeErrorZ {
5118 fn clone(&self) -> Self {
5120 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
5121 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
5124 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
5125 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5131 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
5132 /// but with all dynamically-allocated buffers duplicated in new buffers.
5133 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { orig.clone() }
5135 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
5136 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
5137 /// A pointer to the contents in the success state.
5138 /// Reading from this pointer when `result_ok` is not set is undefined.
5139 pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
5140 /// A pointer to the contents in the error state.
5141 /// Reading from this pointer when `result_ok` is set is undefined.
5142 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5145 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
5146 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5147 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5148 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
5149 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
5150 /// `err` or `result` depending on the state of `result_ok`.
5151 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
5152 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
5153 pub result_ok: bool,
5156 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
5157 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
5158 CResult_AnnouncementSignaturesDecodeErrorZ {
5159 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
5160 result: Box::into_raw(Box::new(o)),
5166 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
5167 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
5168 CResult_AnnouncementSignaturesDecodeErrorZ {
5169 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
5170 err: Box::into_raw(Box::new(e)),
5176 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
5177 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
5178 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
5179 fn drop(&mut self) {
5181 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5182 let _ = unsafe { Box::from_raw(self.contents.result) };
5185 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5186 let _ = unsafe { Box::from_raw(self.contents.err) };
5191 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
5192 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
5193 let contents = if o.result_ok {
5194 let result = unsafe { o.contents.result };
5195 unsafe { o.contents.result = std::ptr::null_mut() };
5196 CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
5198 let err = unsafe { o.contents.err };
5199 unsafe { o.contents.err = std::ptr::null_mut(); }
5200 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
5204 result_ok: o.result_ok,
5208 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
5209 fn clone(&self) -> Self {
5211 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
5212 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
5215 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
5216 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5222 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
5223 /// but with all dynamically-allocated buffers duplicated in new buffers.
5224 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { orig.clone() }
5226 /// The contents of CResult_ChannelReestablishDecodeErrorZ
5227 pub union CResult_ChannelReestablishDecodeErrorZPtr {
5228 /// A pointer to the contents in the success state.
5229 /// Reading from this pointer when `result_ok` is not set is undefined.
5230 pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
5231 /// A pointer to the contents in the error state.
5232 /// Reading from this pointer when `result_ok` is set is undefined.
5233 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5236 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
5237 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
5238 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5239 pub struct CResult_ChannelReestablishDecodeErrorZ {
5240 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
5241 /// `err` or `result` depending on the state of `result_ok`.
5242 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
5243 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
5244 pub result_ok: bool,
5247 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
5248 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
5249 CResult_ChannelReestablishDecodeErrorZ {
5250 contents: CResult_ChannelReestablishDecodeErrorZPtr {
5251 result: Box::into_raw(Box::new(o)),
5257 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
5258 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
5259 CResult_ChannelReestablishDecodeErrorZ {
5260 contents: CResult_ChannelReestablishDecodeErrorZPtr {
5261 err: Box::into_raw(Box::new(e)),
5267 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
5268 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
5269 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
5270 fn drop(&mut self) {
5272 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5273 let _ = unsafe { Box::from_raw(self.contents.result) };
5276 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5277 let _ = unsafe { Box::from_raw(self.contents.err) };
5282 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
5283 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
5284 let contents = if o.result_ok {
5285 let result = unsafe { o.contents.result };
5286 unsafe { o.contents.result = std::ptr::null_mut() };
5287 CResult_ChannelReestablishDecodeErrorZPtr { result }
5289 let err = unsafe { o.contents.err };
5290 unsafe { o.contents.err = std::ptr::null_mut(); }
5291 CResult_ChannelReestablishDecodeErrorZPtr { err }
5295 result_ok: o.result_ok,
5299 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
5300 fn clone(&self) -> Self {
5302 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
5303 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
5306 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
5307 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5313 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
5314 /// but with all dynamically-allocated buffers duplicated in new buffers.
5315 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { orig.clone() }
5317 /// The contents of CResult_ClosingSignedDecodeErrorZ
5318 pub union CResult_ClosingSignedDecodeErrorZPtr {
5319 /// A pointer to the contents in the success state.
5320 /// Reading from this pointer when `result_ok` is not set is undefined.
5321 pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
5322 /// A pointer to the contents in the error state.
5323 /// Reading from this pointer when `result_ok` is set is undefined.
5324 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5327 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
5328 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
5329 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5330 pub struct CResult_ClosingSignedDecodeErrorZ {
5331 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
5332 /// `err` or `result` depending on the state of `result_ok`.
5333 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
5334 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
5335 pub result_ok: bool,
5338 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
5339 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
5340 CResult_ClosingSignedDecodeErrorZ {
5341 contents: CResult_ClosingSignedDecodeErrorZPtr {
5342 result: Box::into_raw(Box::new(o)),
5348 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
5349 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
5350 CResult_ClosingSignedDecodeErrorZ {
5351 contents: CResult_ClosingSignedDecodeErrorZPtr {
5352 err: Box::into_raw(Box::new(e)),
5358 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
5359 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
5360 impl Drop for CResult_ClosingSignedDecodeErrorZ {
5361 fn drop(&mut self) {
5363 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5364 let _ = unsafe { Box::from_raw(self.contents.result) };
5367 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5368 let _ = unsafe { Box::from_raw(self.contents.err) };
5373 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
5374 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
5375 let contents = if o.result_ok {
5376 let result = unsafe { o.contents.result };
5377 unsafe { o.contents.result = std::ptr::null_mut() };
5378 CResult_ClosingSignedDecodeErrorZPtr { result }
5380 let err = unsafe { o.contents.err };
5381 unsafe { o.contents.err = std::ptr::null_mut(); }
5382 CResult_ClosingSignedDecodeErrorZPtr { err }
5386 result_ok: o.result_ok,
5390 impl Clone for CResult_ClosingSignedDecodeErrorZ {
5391 fn clone(&self) -> Self {
5393 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
5394 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
5397 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
5398 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5404 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
5405 /// but with all dynamically-allocated buffers duplicated in new buffers.
5406 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { orig.clone() }
5408 /// The contents of CResult_CommitmentSignedDecodeErrorZ
5409 pub union CResult_CommitmentSignedDecodeErrorZPtr {
5410 /// A pointer to the contents in the success state.
5411 /// Reading from this pointer when `result_ok` is not set is undefined.
5412 pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
5413 /// A pointer to the contents in the error state.
5414 /// Reading from this pointer when `result_ok` is set is undefined.
5415 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5418 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
5419 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
5420 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5421 pub struct CResult_CommitmentSignedDecodeErrorZ {
5422 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
5423 /// `err` or `result` depending on the state of `result_ok`.
5424 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
5425 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
5426 pub result_ok: bool,
5429 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
5430 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
5431 CResult_CommitmentSignedDecodeErrorZ {
5432 contents: CResult_CommitmentSignedDecodeErrorZPtr {
5433 result: Box::into_raw(Box::new(o)),
5439 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
5440 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
5441 CResult_CommitmentSignedDecodeErrorZ {
5442 contents: CResult_CommitmentSignedDecodeErrorZPtr {
5443 err: Box::into_raw(Box::new(e)),
5449 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
5450 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
5451 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
5452 fn drop(&mut self) {
5454 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5455 let _ = unsafe { Box::from_raw(self.contents.result) };
5458 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5459 let _ = unsafe { Box::from_raw(self.contents.err) };
5464 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
5465 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
5466 let contents = if o.result_ok {
5467 let result = unsafe { o.contents.result };
5468 unsafe { o.contents.result = std::ptr::null_mut() };
5469 CResult_CommitmentSignedDecodeErrorZPtr { result }
5471 let err = unsafe { o.contents.err };
5472 unsafe { o.contents.err = std::ptr::null_mut(); }
5473 CResult_CommitmentSignedDecodeErrorZPtr { err }
5477 result_ok: o.result_ok,
5481 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
5482 fn clone(&self) -> Self {
5484 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
5485 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
5488 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
5489 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5495 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
5496 /// but with all dynamically-allocated buffers duplicated in new buffers.
5497 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { orig.clone() }
5499 /// The contents of CResult_FundingCreatedDecodeErrorZ
5500 pub union CResult_FundingCreatedDecodeErrorZPtr {
5501 /// A pointer to the contents in the success state.
5502 /// Reading from this pointer when `result_ok` is not set is undefined.
5503 pub result: *mut crate::lightning::ln::msgs::FundingCreated,
5504 /// A pointer to the contents in the error state.
5505 /// Reading from this pointer when `result_ok` is set is undefined.
5506 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5509 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
5510 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
5511 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5512 pub struct CResult_FundingCreatedDecodeErrorZ {
5513 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
5514 /// `err` or `result` depending on the state of `result_ok`.
5515 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
5516 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
5517 pub result_ok: bool,
5520 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
5521 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
5522 CResult_FundingCreatedDecodeErrorZ {
5523 contents: CResult_FundingCreatedDecodeErrorZPtr {
5524 result: Box::into_raw(Box::new(o)),
5530 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
5531 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
5532 CResult_FundingCreatedDecodeErrorZ {
5533 contents: CResult_FundingCreatedDecodeErrorZPtr {
5534 err: Box::into_raw(Box::new(e)),
5540 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
5541 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
5542 impl Drop for CResult_FundingCreatedDecodeErrorZ {
5543 fn drop(&mut self) {
5545 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5546 let _ = unsafe { Box::from_raw(self.contents.result) };
5549 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5550 let _ = unsafe { Box::from_raw(self.contents.err) };
5555 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
5556 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
5557 let contents = if o.result_ok {
5558 let result = unsafe { o.contents.result };
5559 unsafe { o.contents.result = std::ptr::null_mut() };
5560 CResult_FundingCreatedDecodeErrorZPtr { result }
5562 let err = unsafe { o.contents.err };
5563 unsafe { o.contents.err = std::ptr::null_mut(); }
5564 CResult_FundingCreatedDecodeErrorZPtr { err }
5568 result_ok: o.result_ok,
5572 impl Clone for CResult_FundingCreatedDecodeErrorZ {
5573 fn clone(&self) -> Self {
5575 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
5576 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
5579 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
5580 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5586 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
5587 /// but with all dynamically-allocated buffers duplicated in new buffers.
5588 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { orig.clone() }
5590 /// The contents of CResult_FundingSignedDecodeErrorZ
5591 pub union CResult_FundingSignedDecodeErrorZPtr {
5592 /// A pointer to the contents in the success state.
5593 /// Reading from this pointer when `result_ok` is not set is undefined.
5594 pub result: *mut crate::lightning::ln::msgs::FundingSigned,
5595 /// A pointer to the contents in the error state.
5596 /// Reading from this pointer when `result_ok` is set is undefined.
5597 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5600 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
5601 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
5602 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5603 pub struct CResult_FundingSignedDecodeErrorZ {
5604 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
5605 /// `err` or `result` depending on the state of `result_ok`.
5606 pub contents: CResult_FundingSignedDecodeErrorZPtr,
5607 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
5608 pub result_ok: bool,
5611 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
5612 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
5613 CResult_FundingSignedDecodeErrorZ {
5614 contents: CResult_FundingSignedDecodeErrorZPtr {
5615 result: Box::into_raw(Box::new(o)),
5621 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
5622 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
5623 CResult_FundingSignedDecodeErrorZ {
5624 contents: CResult_FundingSignedDecodeErrorZPtr {
5625 err: Box::into_raw(Box::new(e)),
5631 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
5632 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
5633 impl Drop for CResult_FundingSignedDecodeErrorZ {
5634 fn drop(&mut self) {
5636 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5637 let _ = unsafe { Box::from_raw(self.contents.result) };
5640 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5641 let _ = unsafe { Box::from_raw(self.contents.err) };
5646 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
5647 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
5648 let contents = if o.result_ok {
5649 let result = unsafe { o.contents.result };
5650 unsafe { o.contents.result = std::ptr::null_mut() };
5651 CResult_FundingSignedDecodeErrorZPtr { result }
5653 let err = unsafe { o.contents.err };
5654 unsafe { o.contents.err = std::ptr::null_mut(); }
5655 CResult_FundingSignedDecodeErrorZPtr { err }
5659 result_ok: o.result_ok,
5663 impl Clone for CResult_FundingSignedDecodeErrorZ {
5664 fn clone(&self) -> Self {
5666 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
5667 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
5670 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
5671 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5677 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
5678 /// but with all dynamically-allocated buffers duplicated in new buffers.
5679 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { orig.clone() }
5681 /// The contents of CResult_FundingLockedDecodeErrorZ
5682 pub union CResult_FundingLockedDecodeErrorZPtr {
5683 /// A pointer to the contents in the success state.
5684 /// Reading from this pointer when `result_ok` is not set is undefined.
5685 pub result: *mut crate::lightning::ln::msgs::FundingLocked,
5686 /// A pointer to the contents in the error state.
5687 /// Reading from this pointer when `result_ok` is set is undefined.
5688 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5691 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
5692 /// containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
5693 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5694 pub struct CResult_FundingLockedDecodeErrorZ {
5695 /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
5696 /// `err` or `result` depending on the state of `result_ok`.
5697 pub contents: CResult_FundingLockedDecodeErrorZPtr,
5698 /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
5699 pub result_ok: bool,
5702 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
5703 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
5704 CResult_FundingLockedDecodeErrorZ {
5705 contents: CResult_FundingLockedDecodeErrorZPtr {
5706 result: Box::into_raw(Box::new(o)),
5712 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
5713 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
5714 CResult_FundingLockedDecodeErrorZ {
5715 contents: CResult_FundingLockedDecodeErrorZPtr {
5716 err: Box::into_raw(Box::new(e)),
5722 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
5723 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
5724 impl Drop for CResult_FundingLockedDecodeErrorZ {
5725 fn drop(&mut self) {
5727 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5728 let _ = unsafe { Box::from_raw(self.contents.result) };
5731 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5732 let _ = unsafe { Box::from_raw(self.contents.err) };
5737 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
5738 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
5739 let contents = if o.result_ok {
5740 let result = unsafe { o.contents.result };
5741 unsafe { o.contents.result = std::ptr::null_mut() };
5742 CResult_FundingLockedDecodeErrorZPtr { result }
5744 let err = unsafe { o.contents.err };
5745 unsafe { o.contents.err = std::ptr::null_mut(); }
5746 CResult_FundingLockedDecodeErrorZPtr { err }
5750 result_ok: o.result_ok,
5754 impl Clone for CResult_FundingLockedDecodeErrorZ {
5755 fn clone(&self) -> Self {
5757 Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
5758 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
5761 Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
5762 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5768 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
5769 /// but with all dynamically-allocated buffers duplicated in new buffers.
5770 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { orig.clone() }
5772 /// The contents of CResult_InitDecodeErrorZ
5773 pub union CResult_InitDecodeErrorZPtr {
5774 /// A pointer to the contents in the success state.
5775 /// Reading from this pointer when `result_ok` is not set is undefined.
5776 pub result: *mut crate::lightning::ln::msgs::Init,
5777 /// A pointer to the contents in the error state.
5778 /// Reading from this pointer when `result_ok` is set is undefined.
5779 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5782 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
5783 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
5784 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5785 pub struct CResult_InitDecodeErrorZ {
5786 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
5787 /// `err` or `result` depending on the state of `result_ok`.
5788 pub contents: CResult_InitDecodeErrorZPtr,
5789 /// Whether this CResult_InitDecodeErrorZ represents a success state.
5790 pub result_ok: bool,
5793 /// Creates a new CResult_InitDecodeErrorZ in the success state.
5794 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
5795 CResult_InitDecodeErrorZ {
5796 contents: CResult_InitDecodeErrorZPtr {
5797 result: Box::into_raw(Box::new(o)),
5803 /// Creates a new CResult_InitDecodeErrorZ in the error state.
5804 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
5805 CResult_InitDecodeErrorZ {
5806 contents: CResult_InitDecodeErrorZPtr {
5807 err: Box::into_raw(Box::new(e)),
5813 /// Frees any resources used by the CResult_InitDecodeErrorZ.
5814 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
5815 impl Drop for CResult_InitDecodeErrorZ {
5816 fn drop(&mut self) {
5818 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5819 let _ = unsafe { Box::from_raw(self.contents.result) };
5822 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5823 let _ = unsafe { Box::from_raw(self.contents.err) };
5828 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
5829 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
5830 let contents = if o.result_ok {
5831 let result = unsafe { o.contents.result };
5832 unsafe { o.contents.result = std::ptr::null_mut() };
5833 CResult_InitDecodeErrorZPtr { result }
5835 let err = unsafe { o.contents.err };
5836 unsafe { o.contents.err = std::ptr::null_mut(); }
5837 CResult_InitDecodeErrorZPtr { err }
5841 result_ok: o.result_ok,
5845 impl Clone for CResult_InitDecodeErrorZ {
5846 fn clone(&self) -> Self {
5848 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
5849 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
5852 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
5853 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5859 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
5860 /// but with all dynamically-allocated buffers duplicated in new buffers.
5861 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { orig.clone() }
5863 /// The contents of CResult_OpenChannelDecodeErrorZ
5864 pub union CResult_OpenChannelDecodeErrorZPtr {
5865 /// A pointer to the contents in the success state.
5866 /// Reading from this pointer when `result_ok` is not set is undefined.
5867 pub result: *mut crate::lightning::ln::msgs::OpenChannel,
5868 /// A pointer to the contents in the error state.
5869 /// Reading from this pointer when `result_ok` is set is undefined.
5870 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5873 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
5874 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
5875 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5876 pub struct CResult_OpenChannelDecodeErrorZ {
5877 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
5878 /// `err` or `result` depending on the state of `result_ok`.
5879 pub contents: CResult_OpenChannelDecodeErrorZPtr,
5880 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
5881 pub result_ok: bool,
5884 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
5885 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
5886 CResult_OpenChannelDecodeErrorZ {
5887 contents: CResult_OpenChannelDecodeErrorZPtr {
5888 result: Box::into_raw(Box::new(o)),
5894 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
5895 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
5896 CResult_OpenChannelDecodeErrorZ {
5897 contents: CResult_OpenChannelDecodeErrorZPtr {
5898 err: Box::into_raw(Box::new(e)),
5904 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
5905 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
5906 impl Drop for CResult_OpenChannelDecodeErrorZ {
5907 fn drop(&mut self) {
5909 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5910 let _ = unsafe { Box::from_raw(self.contents.result) };
5913 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5914 let _ = unsafe { Box::from_raw(self.contents.err) };
5919 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
5920 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
5921 let contents = if o.result_ok {
5922 let result = unsafe { o.contents.result };
5923 unsafe { o.contents.result = std::ptr::null_mut() };
5924 CResult_OpenChannelDecodeErrorZPtr { result }
5926 let err = unsafe { o.contents.err };
5927 unsafe { o.contents.err = std::ptr::null_mut(); }
5928 CResult_OpenChannelDecodeErrorZPtr { err }
5932 result_ok: o.result_ok,
5936 impl Clone for CResult_OpenChannelDecodeErrorZ {
5937 fn clone(&self) -> Self {
5939 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
5940 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
5943 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
5944 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5950 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
5951 /// but with all dynamically-allocated buffers duplicated in new buffers.
5952 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { orig.clone() }
5954 /// The contents of CResult_RevokeAndACKDecodeErrorZ
5955 pub union CResult_RevokeAndACKDecodeErrorZPtr {
5956 /// A pointer to the contents in the success state.
5957 /// Reading from this pointer when `result_ok` is not set is undefined.
5958 pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
5959 /// A pointer to the contents in the error state.
5960 /// Reading from this pointer when `result_ok` is set is undefined.
5961 pub err: *mut crate::lightning::ln::msgs::DecodeError,
5964 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
5965 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
5966 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5967 pub struct CResult_RevokeAndACKDecodeErrorZ {
5968 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
5969 /// `err` or `result` depending on the state of `result_ok`.
5970 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
5971 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
5972 pub result_ok: bool,
5975 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
5976 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
5977 CResult_RevokeAndACKDecodeErrorZ {
5978 contents: CResult_RevokeAndACKDecodeErrorZPtr {
5979 result: Box::into_raw(Box::new(o)),
5985 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
5986 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
5987 CResult_RevokeAndACKDecodeErrorZ {
5988 contents: CResult_RevokeAndACKDecodeErrorZPtr {
5989 err: Box::into_raw(Box::new(e)),
5995 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
5996 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
5997 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
5998 fn drop(&mut self) {
6000 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6001 let _ = unsafe { Box::from_raw(self.contents.result) };
6004 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6005 let _ = unsafe { Box::from_raw(self.contents.err) };
6010 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
6011 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
6012 let contents = if o.result_ok {
6013 let result = unsafe { o.contents.result };
6014 unsafe { o.contents.result = std::ptr::null_mut() };
6015 CResult_RevokeAndACKDecodeErrorZPtr { result }
6017 let err = unsafe { o.contents.err };
6018 unsafe { o.contents.err = std::ptr::null_mut(); }
6019 CResult_RevokeAndACKDecodeErrorZPtr { err }
6023 result_ok: o.result_ok,
6027 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
6028 fn clone(&self) -> Self {
6030 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
6031 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
6034 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
6035 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6041 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
6042 /// but with all dynamically-allocated buffers duplicated in new buffers.
6043 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { orig.clone() }
6045 /// The contents of CResult_ShutdownDecodeErrorZ
6046 pub union CResult_ShutdownDecodeErrorZPtr {
6047 /// A pointer to the contents in the success state.
6048 /// Reading from this pointer when `result_ok` is not set is undefined.
6049 pub result: *mut crate::lightning::ln::msgs::Shutdown,
6050 /// A pointer to the contents in the error state.
6051 /// Reading from this pointer when `result_ok` is set is undefined.
6052 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6055 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
6056 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
6057 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6058 pub struct CResult_ShutdownDecodeErrorZ {
6059 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
6060 /// `err` or `result` depending on the state of `result_ok`.
6061 pub contents: CResult_ShutdownDecodeErrorZPtr,
6062 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
6063 pub result_ok: bool,
6066 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
6067 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
6068 CResult_ShutdownDecodeErrorZ {
6069 contents: CResult_ShutdownDecodeErrorZPtr {
6070 result: Box::into_raw(Box::new(o)),
6076 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
6077 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
6078 CResult_ShutdownDecodeErrorZ {
6079 contents: CResult_ShutdownDecodeErrorZPtr {
6080 err: Box::into_raw(Box::new(e)),
6086 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
6087 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
6088 impl Drop for CResult_ShutdownDecodeErrorZ {
6089 fn drop(&mut self) {
6091 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6092 let _ = unsafe { Box::from_raw(self.contents.result) };
6095 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6096 let _ = unsafe { Box::from_raw(self.contents.err) };
6101 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
6102 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
6103 let contents = if o.result_ok {
6104 let result = unsafe { o.contents.result };
6105 unsafe { o.contents.result = std::ptr::null_mut() };
6106 CResult_ShutdownDecodeErrorZPtr { result }
6108 let err = unsafe { o.contents.err };
6109 unsafe { o.contents.err = std::ptr::null_mut(); }
6110 CResult_ShutdownDecodeErrorZPtr { err }
6114 result_ok: o.result_ok,
6118 impl Clone for CResult_ShutdownDecodeErrorZ {
6119 fn clone(&self) -> Self {
6121 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
6122 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
6125 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
6126 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6132 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
6133 /// but with all dynamically-allocated buffers duplicated in new buffers.
6134 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { orig.clone() }
6136 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
6137 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
6138 /// A pointer to the contents in the success state.
6139 /// Reading from this pointer when `result_ok` is not set is undefined.
6140 pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
6141 /// A pointer to the contents in the error state.
6142 /// Reading from this pointer when `result_ok` is set is undefined.
6143 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6146 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
6147 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
6148 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6149 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
6150 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
6151 /// `err` or `result` depending on the state of `result_ok`.
6152 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
6153 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
6154 pub result_ok: bool,
6157 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
6158 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
6159 CResult_UpdateFailHTLCDecodeErrorZ {
6160 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
6161 result: Box::into_raw(Box::new(o)),
6167 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
6168 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
6169 CResult_UpdateFailHTLCDecodeErrorZ {
6170 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
6171 err: Box::into_raw(Box::new(e)),
6177 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
6178 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
6179 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
6180 fn drop(&mut self) {
6182 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6183 let _ = unsafe { Box::from_raw(self.contents.result) };
6186 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6187 let _ = unsafe { Box::from_raw(self.contents.err) };
6192 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
6193 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
6194 let contents = if o.result_ok {
6195 let result = unsafe { o.contents.result };
6196 unsafe { o.contents.result = std::ptr::null_mut() };
6197 CResult_UpdateFailHTLCDecodeErrorZPtr { result }
6199 let err = unsafe { o.contents.err };
6200 unsafe { o.contents.err = std::ptr::null_mut(); }
6201 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
6205 result_ok: o.result_ok,
6209 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
6210 fn clone(&self) -> Self {
6212 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
6213 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
6216 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
6217 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6223 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
6224 /// but with all dynamically-allocated buffers duplicated in new buffers.
6225 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { orig.clone() }
6227 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
6228 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
6229 /// A pointer to the contents in the success state.
6230 /// Reading from this pointer when `result_ok` is not set is undefined.
6231 pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
6232 /// A pointer to the contents in the error state.
6233 /// Reading from this pointer when `result_ok` is set is undefined.
6234 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6237 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
6238 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
6239 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6240 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
6241 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
6242 /// `err` or `result` depending on the state of `result_ok`.
6243 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
6244 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
6245 pub result_ok: bool,
6248 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
6249 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
6250 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
6251 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
6252 result: Box::into_raw(Box::new(o)),
6258 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
6259 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
6260 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
6261 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
6262 err: Box::into_raw(Box::new(e)),
6268 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
6269 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
6270 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
6271 fn drop(&mut self) {
6273 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6274 let _ = unsafe { Box::from_raw(self.contents.result) };
6277 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6278 let _ = unsafe { Box::from_raw(self.contents.err) };
6283 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
6284 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
6285 let contents = if o.result_ok {
6286 let result = unsafe { o.contents.result };
6287 unsafe { o.contents.result = std::ptr::null_mut() };
6288 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
6290 let err = unsafe { o.contents.err };
6291 unsafe { o.contents.err = std::ptr::null_mut(); }
6292 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
6296 result_ok: o.result_ok,
6300 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
6301 fn clone(&self) -> Self {
6303 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
6304 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
6307 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
6308 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6314 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
6315 /// but with all dynamically-allocated buffers duplicated in new buffers.
6316 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { orig.clone() }
6318 /// The contents of CResult_UpdateFeeDecodeErrorZ
6319 pub union CResult_UpdateFeeDecodeErrorZPtr {
6320 /// A pointer to the contents in the success state.
6321 /// Reading from this pointer when `result_ok` is not set is undefined.
6322 pub result: *mut crate::lightning::ln::msgs::UpdateFee,
6323 /// A pointer to the contents in the error state.
6324 /// Reading from this pointer when `result_ok` is set is undefined.
6325 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6328 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
6329 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
6330 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6331 pub struct CResult_UpdateFeeDecodeErrorZ {
6332 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
6333 /// `err` or `result` depending on the state of `result_ok`.
6334 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
6335 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
6336 pub result_ok: bool,
6339 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
6340 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
6341 CResult_UpdateFeeDecodeErrorZ {
6342 contents: CResult_UpdateFeeDecodeErrorZPtr {
6343 result: Box::into_raw(Box::new(o)),
6349 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
6350 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
6351 CResult_UpdateFeeDecodeErrorZ {
6352 contents: CResult_UpdateFeeDecodeErrorZPtr {
6353 err: Box::into_raw(Box::new(e)),
6359 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
6360 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
6361 impl Drop for CResult_UpdateFeeDecodeErrorZ {
6362 fn drop(&mut self) {
6364 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6365 let _ = unsafe { Box::from_raw(self.contents.result) };
6368 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6369 let _ = unsafe { Box::from_raw(self.contents.err) };
6374 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
6375 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
6376 let contents = if o.result_ok {
6377 let result = unsafe { o.contents.result };
6378 unsafe { o.contents.result = std::ptr::null_mut() };
6379 CResult_UpdateFeeDecodeErrorZPtr { result }
6381 let err = unsafe { o.contents.err };
6382 unsafe { o.contents.err = std::ptr::null_mut(); }
6383 CResult_UpdateFeeDecodeErrorZPtr { err }
6387 result_ok: o.result_ok,
6391 impl Clone for CResult_UpdateFeeDecodeErrorZ {
6392 fn clone(&self) -> Self {
6394 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
6395 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
6398 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
6399 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6405 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
6406 /// but with all dynamically-allocated buffers duplicated in new buffers.
6407 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { orig.clone() }
6409 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
6410 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
6411 /// A pointer to the contents in the success state.
6412 /// Reading from this pointer when `result_ok` is not set is undefined.
6413 pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
6414 /// A pointer to the contents in the error state.
6415 /// Reading from this pointer when `result_ok` is set is undefined.
6416 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6419 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
6420 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
6421 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6422 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
6423 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
6424 /// `err` or `result` depending on the state of `result_ok`.
6425 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
6426 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
6427 pub result_ok: bool,
6430 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
6431 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
6432 CResult_UpdateFulfillHTLCDecodeErrorZ {
6433 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
6434 result: Box::into_raw(Box::new(o)),
6440 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
6441 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
6442 CResult_UpdateFulfillHTLCDecodeErrorZ {
6443 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
6444 err: Box::into_raw(Box::new(e)),
6450 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
6451 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
6452 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
6453 fn drop(&mut self) {
6455 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6456 let _ = unsafe { Box::from_raw(self.contents.result) };
6459 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6460 let _ = unsafe { Box::from_raw(self.contents.err) };
6465 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
6466 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
6467 let contents = if o.result_ok {
6468 let result = unsafe { o.contents.result };
6469 unsafe { o.contents.result = std::ptr::null_mut() };
6470 CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
6472 let err = unsafe { o.contents.err };
6473 unsafe { o.contents.err = std::ptr::null_mut(); }
6474 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
6478 result_ok: o.result_ok,
6482 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
6483 fn clone(&self) -> Self {
6485 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
6486 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
6489 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
6490 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6496 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
6497 /// but with all dynamically-allocated buffers duplicated in new buffers.
6498 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { orig.clone() }
6500 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
6501 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
6502 /// A pointer to the contents in the success state.
6503 /// Reading from this pointer when `result_ok` is not set is undefined.
6504 pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
6505 /// A pointer to the contents in the error state.
6506 /// Reading from this pointer when `result_ok` is set is undefined.
6507 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6510 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
6511 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
6512 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6513 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
6514 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
6515 /// `err` or `result` depending on the state of `result_ok`.
6516 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
6517 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
6518 pub result_ok: bool,
6521 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
6522 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
6523 CResult_UpdateAddHTLCDecodeErrorZ {
6524 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
6525 result: Box::into_raw(Box::new(o)),
6531 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
6532 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
6533 CResult_UpdateAddHTLCDecodeErrorZ {
6534 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
6535 err: Box::into_raw(Box::new(e)),
6541 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
6542 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
6543 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
6544 fn drop(&mut self) {
6546 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6547 let _ = unsafe { Box::from_raw(self.contents.result) };
6550 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6551 let _ = unsafe { Box::from_raw(self.contents.err) };
6556 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
6557 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
6558 let contents = if o.result_ok {
6559 let result = unsafe { o.contents.result };
6560 unsafe { o.contents.result = std::ptr::null_mut() };
6561 CResult_UpdateAddHTLCDecodeErrorZPtr { result }
6563 let err = unsafe { o.contents.err };
6564 unsafe { o.contents.err = std::ptr::null_mut(); }
6565 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
6569 result_ok: o.result_ok,
6573 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
6574 fn clone(&self) -> Self {
6576 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
6577 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
6580 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
6581 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6587 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
6588 /// but with all dynamically-allocated buffers duplicated in new buffers.
6589 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { orig.clone() }
6591 /// The contents of CResult_PingDecodeErrorZ
6592 pub union CResult_PingDecodeErrorZPtr {
6593 /// A pointer to the contents in the success state.
6594 /// Reading from this pointer when `result_ok` is not set is undefined.
6595 pub result: *mut crate::lightning::ln::msgs::Ping,
6596 /// A pointer to the contents in the error state.
6597 /// Reading from this pointer when `result_ok` is set is undefined.
6598 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6601 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
6602 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
6603 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6604 pub struct CResult_PingDecodeErrorZ {
6605 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
6606 /// `err` or `result` depending on the state of `result_ok`.
6607 pub contents: CResult_PingDecodeErrorZPtr,
6608 /// Whether this CResult_PingDecodeErrorZ represents a success state.
6609 pub result_ok: bool,
6612 /// Creates a new CResult_PingDecodeErrorZ in the success state.
6613 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
6614 CResult_PingDecodeErrorZ {
6615 contents: CResult_PingDecodeErrorZPtr {
6616 result: Box::into_raw(Box::new(o)),
6622 /// Creates a new CResult_PingDecodeErrorZ in the error state.
6623 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
6624 CResult_PingDecodeErrorZ {
6625 contents: CResult_PingDecodeErrorZPtr {
6626 err: Box::into_raw(Box::new(e)),
6632 /// Frees any resources used by the CResult_PingDecodeErrorZ.
6633 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
6634 impl Drop for CResult_PingDecodeErrorZ {
6635 fn drop(&mut self) {
6637 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6638 let _ = unsafe { Box::from_raw(self.contents.result) };
6641 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6642 let _ = unsafe { Box::from_raw(self.contents.err) };
6647 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
6648 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
6649 let contents = if o.result_ok {
6650 let result = unsafe { o.contents.result };
6651 unsafe { o.contents.result = std::ptr::null_mut() };
6652 CResult_PingDecodeErrorZPtr { result }
6654 let err = unsafe { o.contents.err };
6655 unsafe { o.contents.err = std::ptr::null_mut(); }
6656 CResult_PingDecodeErrorZPtr { err }
6660 result_ok: o.result_ok,
6664 impl Clone for CResult_PingDecodeErrorZ {
6665 fn clone(&self) -> Self {
6667 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
6668 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
6671 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
6672 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6678 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
6679 /// but with all dynamically-allocated buffers duplicated in new buffers.
6680 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { orig.clone() }
6682 /// The contents of CResult_PongDecodeErrorZ
6683 pub union CResult_PongDecodeErrorZPtr {
6684 /// A pointer to the contents in the success state.
6685 /// Reading from this pointer when `result_ok` is not set is undefined.
6686 pub result: *mut crate::lightning::ln::msgs::Pong,
6687 /// A pointer to the contents in the error state.
6688 /// Reading from this pointer when `result_ok` is set is undefined.
6689 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6692 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
6693 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
6694 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6695 pub struct CResult_PongDecodeErrorZ {
6696 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
6697 /// `err` or `result` depending on the state of `result_ok`.
6698 pub contents: CResult_PongDecodeErrorZPtr,
6699 /// Whether this CResult_PongDecodeErrorZ represents a success state.
6700 pub result_ok: bool,
6703 /// Creates a new CResult_PongDecodeErrorZ in the success state.
6704 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
6705 CResult_PongDecodeErrorZ {
6706 contents: CResult_PongDecodeErrorZPtr {
6707 result: Box::into_raw(Box::new(o)),
6713 /// Creates a new CResult_PongDecodeErrorZ in the error state.
6714 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
6715 CResult_PongDecodeErrorZ {
6716 contents: CResult_PongDecodeErrorZPtr {
6717 err: Box::into_raw(Box::new(e)),
6723 /// Frees any resources used by the CResult_PongDecodeErrorZ.
6724 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
6725 impl Drop for CResult_PongDecodeErrorZ {
6726 fn drop(&mut self) {
6728 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6729 let _ = unsafe { Box::from_raw(self.contents.result) };
6732 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6733 let _ = unsafe { Box::from_raw(self.contents.err) };
6738 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
6739 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
6740 let contents = if o.result_ok {
6741 let result = unsafe { o.contents.result };
6742 unsafe { o.contents.result = std::ptr::null_mut() };
6743 CResult_PongDecodeErrorZPtr { result }
6745 let err = unsafe { o.contents.err };
6746 unsafe { o.contents.err = std::ptr::null_mut(); }
6747 CResult_PongDecodeErrorZPtr { err }
6751 result_ok: o.result_ok,
6755 impl Clone for CResult_PongDecodeErrorZ {
6756 fn clone(&self) -> Self {
6758 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
6759 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
6762 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
6763 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6769 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
6770 /// but with all dynamically-allocated buffers duplicated in new buffers.
6771 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { orig.clone() }
6773 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
6774 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
6775 /// A pointer to the contents in the success state.
6776 /// Reading from this pointer when `result_ok` is not set is undefined.
6777 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
6778 /// A pointer to the contents in the error state.
6779 /// Reading from this pointer when `result_ok` is set is undefined.
6780 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6783 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
6784 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
6785 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6786 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
6787 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
6788 /// `err` or `result` depending on the state of `result_ok`.
6789 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
6790 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
6791 pub result_ok: bool,
6794 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
6795 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
6796 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
6797 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
6798 result: Box::into_raw(Box::new(o)),
6804 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
6805 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
6806 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
6807 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
6808 err: Box::into_raw(Box::new(e)),
6814 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
6815 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
6816 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
6817 fn drop(&mut self) {
6819 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6820 let _ = unsafe { Box::from_raw(self.contents.result) };
6823 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6824 let _ = unsafe { Box::from_raw(self.contents.err) };
6829 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
6830 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
6831 let contents = if o.result_ok {
6832 let result = unsafe { o.contents.result };
6833 unsafe { o.contents.result = std::ptr::null_mut() };
6834 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
6836 let err = unsafe { o.contents.err };
6837 unsafe { o.contents.err = std::ptr::null_mut(); }
6838 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
6842 result_ok: o.result_ok,
6846 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
6847 fn clone(&self) -> Self {
6849 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
6850 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
6853 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
6854 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6860 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
6861 /// but with all dynamically-allocated buffers duplicated in new buffers.
6862 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { orig.clone() }
6864 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
6865 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
6866 /// A pointer to the contents in the success state.
6867 /// Reading from this pointer when `result_ok` is not set is undefined.
6868 pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
6869 /// A pointer to the contents in the error state.
6870 /// Reading from this pointer when `result_ok` is set is undefined.
6871 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6874 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
6875 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
6876 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6877 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
6878 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
6879 /// `err` or `result` depending on the state of `result_ok`.
6880 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
6881 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
6882 pub result_ok: bool,
6885 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
6886 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
6887 CResult_ChannelAnnouncementDecodeErrorZ {
6888 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
6889 result: Box::into_raw(Box::new(o)),
6895 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
6896 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
6897 CResult_ChannelAnnouncementDecodeErrorZ {
6898 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
6899 err: Box::into_raw(Box::new(e)),
6905 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
6906 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
6907 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
6908 fn drop(&mut self) {
6910 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6911 let _ = unsafe { Box::from_raw(self.contents.result) };
6914 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6915 let _ = unsafe { Box::from_raw(self.contents.err) };
6920 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
6921 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
6922 let contents = if o.result_ok {
6923 let result = unsafe { o.contents.result };
6924 unsafe { o.contents.result = std::ptr::null_mut() };
6925 CResult_ChannelAnnouncementDecodeErrorZPtr { result }
6927 let err = unsafe { o.contents.err };
6928 unsafe { o.contents.err = std::ptr::null_mut(); }
6929 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
6933 result_ok: o.result_ok,
6937 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
6938 fn clone(&self) -> Self {
6940 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
6941 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
6944 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
6945 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6951 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
6952 /// but with all dynamically-allocated buffers duplicated in new buffers.
6953 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { orig.clone() }
6955 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
6956 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
6957 /// A pointer to the contents in the success state.
6958 /// Reading from this pointer when `result_ok` is not set is undefined.
6959 pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
6960 /// A pointer to the contents in the error state.
6961 /// Reading from this pointer when `result_ok` is set is undefined.
6962 pub err: *mut crate::lightning::ln::msgs::DecodeError,
6965 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
6966 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
6967 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6968 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
6969 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
6970 /// `err` or `result` depending on the state of `result_ok`.
6971 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
6972 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
6973 pub result_ok: bool,
6976 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
6977 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
6978 CResult_UnsignedChannelUpdateDecodeErrorZ {
6979 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
6980 result: Box::into_raw(Box::new(o)),
6986 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
6987 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
6988 CResult_UnsignedChannelUpdateDecodeErrorZ {
6989 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
6990 err: Box::into_raw(Box::new(e)),
6996 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
6997 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
6998 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
6999 fn drop(&mut self) {
7001 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7002 let _ = unsafe { Box::from_raw(self.contents.result) };
7005 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7006 let _ = unsafe { Box::from_raw(self.contents.err) };
7011 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
7012 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
7013 let contents = if o.result_ok {
7014 let result = unsafe { o.contents.result };
7015 unsafe { o.contents.result = std::ptr::null_mut() };
7016 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
7018 let err = unsafe { o.contents.err };
7019 unsafe { o.contents.err = std::ptr::null_mut(); }
7020 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
7024 result_ok: o.result_ok,
7028 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
7029 fn clone(&self) -> Self {
7031 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
7032 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
7035 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
7036 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7042 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
7043 /// but with all dynamically-allocated buffers duplicated in new buffers.
7044 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { orig.clone() }
7046 /// The contents of CResult_ChannelUpdateDecodeErrorZ
7047 pub union CResult_ChannelUpdateDecodeErrorZPtr {
7048 /// A pointer to the contents in the success state.
7049 /// Reading from this pointer when `result_ok` is not set is undefined.
7050 pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
7051 /// A pointer to the contents in the error state.
7052 /// Reading from this pointer when `result_ok` is set is undefined.
7053 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7056 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
7057 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
7058 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7059 pub struct CResult_ChannelUpdateDecodeErrorZ {
7060 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
7061 /// `err` or `result` depending on the state of `result_ok`.
7062 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
7063 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
7064 pub result_ok: bool,
7067 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
7068 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
7069 CResult_ChannelUpdateDecodeErrorZ {
7070 contents: CResult_ChannelUpdateDecodeErrorZPtr {
7071 result: Box::into_raw(Box::new(o)),
7077 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
7078 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
7079 CResult_ChannelUpdateDecodeErrorZ {
7080 contents: CResult_ChannelUpdateDecodeErrorZPtr {
7081 err: Box::into_raw(Box::new(e)),
7087 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
7088 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
7089 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
7090 fn drop(&mut self) {
7092 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7093 let _ = unsafe { Box::from_raw(self.contents.result) };
7096 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7097 let _ = unsafe { Box::from_raw(self.contents.err) };
7102 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
7103 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
7104 let contents = if o.result_ok {
7105 let result = unsafe { o.contents.result };
7106 unsafe { o.contents.result = std::ptr::null_mut() };
7107 CResult_ChannelUpdateDecodeErrorZPtr { result }
7109 let err = unsafe { o.contents.err };
7110 unsafe { o.contents.err = std::ptr::null_mut(); }
7111 CResult_ChannelUpdateDecodeErrorZPtr { err }
7115 result_ok: o.result_ok,
7119 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
7120 fn clone(&self) -> Self {
7122 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
7123 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
7126 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
7127 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7133 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
7134 /// but with all dynamically-allocated buffers duplicated in new buffers.
7135 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { orig.clone() }
7137 /// The contents of CResult_ErrorMessageDecodeErrorZ
7138 pub union CResult_ErrorMessageDecodeErrorZPtr {
7139 /// A pointer to the contents in the success state.
7140 /// Reading from this pointer when `result_ok` is not set is undefined.
7141 pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
7142 /// A pointer to the contents in the error state.
7143 /// Reading from this pointer when `result_ok` is set is undefined.
7144 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7147 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
7148 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
7149 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7150 pub struct CResult_ErrorMessageDecodeErrorZ {
7151 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
7152 /// `err` or `result` depending on the state of `result_ok`.
7153 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
7154 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
7155 pub result_ok: bool,
7158 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
7159 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
7160 CResult_ErrorMessageDecodeErrorZ {
7161 contents: CResult_ErrorMessageDecodeErrorZPtr {
7162 result: Box::into_raw(Box::new(o)),
7168 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
7169 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
7170 CResult_ErrorMessageDecodeErrorZ {
7171 contents: CResult_ErrorMessageDecodeErrorZPtr {
7172 err: Box::into_raw(Box::new(e)),
7178 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
7179 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
7180 impl Drop for CResult_ErrorMessageDecodeErrorZ {
7181 fn drop(&mut self) {
7183 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7184 let _ = unsafe { Box::from_raw(self.contents.result) };
7187 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7188 let _ = unsafe { Box::from_raw(self.contents.err) };
7193 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
7194 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
7195 let contents = if o.result_ok {
7196 let result = unsafe { o.contents.result };
7197 unsafe { o.contents.result = std::ptr::null_mut() };
7198 CResult_ErrorMessageDecodeErrorZPtr { result }
7200 let err = unsafe { o.contents.err };
7201 unsafe { o.contents.err = std::ptr::null_mut(); }
7202 CResult_ErrorMessageDecodeErrorZPtr { err }
7206 result_ok: o.result_ok,
7210 impl Clone for CResult_ErrorMessageDecodeErrorZ {
7211 fn clone(&self) -> Self {
7213 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
7214 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
7217 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
7218 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7224 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
7225 /// but with all dynamically-allocated buffers duplicated in new buffers.
7226 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { orig.clone() }
7228 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
7229 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
7230 /// A pointer to the contents in the success state.
7231 /// Reading from this pointer when `result_ok` is not set is undefined.
7232 pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
7233 /// A pointer to the contents in the error state.
7234 /// Reading from this pointer when `result_ok` is set is undefined.
7235 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7238 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
7239 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
7240 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7241 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
7242 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
7243 /// `err` or `result` depending on the state of `result_ok`.
7244 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
7245 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
7246 pub result_ok: bool,
7249 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
7250 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
7251 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
7252 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
7253 result: Box::into_raw(Box::new(o)),
7259 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
7260 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
7261 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
7262 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
7263 err: Box::into_raw(Box::new(e)),
7269 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
7270 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
7271 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
7272 fn drop(&mut self) {
7274 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7275 let _ = unsafe { Box::from_raw(self.contents.result) };
7278 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7279 let _ = unsafe { Box::from_raw(self.contents.err) };
7284 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
7285 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
7286 let contents = if o.result_ok {
7287 let result = unsafe { o.contents.result };
7288 unsafe { o.contents.result = std::ptr::null_mut() };
7289 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
7291 let err = unsafe { o.contents.err };
7292 unsafe { o.contents.err = std::ptr::null_mut(); }
7293 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
7297 result_ok: o.result_ok,
7301 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
7302 fn clone(&self) -> Self {
7304 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
7305 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
7308 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
7309 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7315 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
7316 /// but with all dynamically-allocated buffers duplicated in new buffers.
7317 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { orig.clone() }
7319 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
7320 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
7321 /// A pointer to the contents in the success state.
7322 /// Reading from this pointer when `result_ok` is not set is undefined.
7323 pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
7324 /// A pointer to the contents in the error state.
7325 /// Reading from this pointer when `result_ok` is set is undefined.
7326 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7329 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
7330 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
7331 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7332 pub struct CResult_NodeAnnouncementDecodeErrorZ {
7333 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
7334 /// `err` or `result` depending on the state of `result_ok`.
7335 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
7336 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
7337 pub result_ok: bool,
7340 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
7341 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
7342 CResult_NodeAnnouncementDecodeErrorZ {
7343 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
7344 result: Box::into_raw(Box::new(o)),
7350 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
7351 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
7352 CResult_NodeAnnouncementDecodeErrorZ {
7353 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
7354 err: Box::into_raw(Box::new(e)),
7360 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
7361 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
7362 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
7363 fn drop(&mut self) {
7365 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7366 let _ = unsafe { Box::from_raw(self.contents.result) };
7369 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7370 let _ = unsafe { Box::from_raw(self.contents.err) };
7375 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
7376 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
7377 let contents = if o.result_ok {
7378 let result = unsafe { o.contents.result };
7379 unsafe { o.contents.result = std::ptr::null_mut() };
7380 CResult_NodeAnnouncementDecodeErrorZPtr { result }
7382 let err = unsafe { o.contents.err };
7383 unsafe { o.contents.err = std::ptr::null_mut(); }
7384 CResult_NodeAnnouncementDecodeErrorZPtr { err }
7388 result_ok: o.result_ok,
7392 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
7393 fn clone(&self) -> Self {
7395 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
7396 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
7399 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
7400 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7406 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
7407 /// but with all dynamically-allocated buffers duplicated in new buffers.
7408 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { orig.clone() }
7410 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
7411 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
7412 /// A pointer to the contents in the success state.
7413 /// Reading from this pointer when `result_ok` is not set is undefined.
7414 pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
7415 /// A pointer to the contents in the error state.
7416 /// Reading from this pointer when `result_ok` is set is undefined.
7417 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7420 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
7421 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
7422 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7423 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
7424 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
7425 /// `err` or `result` depending on the state of `result_ok`.
7426 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
7427 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
7428 pub result_ok: bool,
7431 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
7432 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
7433 CResult_QueryShortChannelIdsDecodeErrorZ {
7434 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
7435 result: Box::into_raw(Box::new(o)),
7441 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
7442 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
7443 CResult_QueryShortChannelIdsDecodeErrorZ {
7444 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
7445 err: Box::into_raw(Box::new(e)),
7451 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
7452 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
7453 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
7454 fn drop(&mut self) {
7456 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7457 let _ = unsafe { Box::from_raw(self.contents.result) };
7460 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7461 let _ = unsafe { Box::from_raw(self.contents.err) };
7466 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
7467 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
7468 let contents = if o.result_ok {
7469 let result = unsafe { o.contents.result };
7470 unsafe { o.contents.result = std::ptr::null_mut() };
7471 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
7473 let err = unsafe { o.contents.err };
7474 unsafe { o.contents.err = std::ptr::null_mut(); }
7475 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
7479 result_ok: o.result_ok,
7483 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
7484 fn clone(&self) -> Self {
7486 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
7487 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
7490 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
7491 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7497 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
7498 /// but with all dynamically-allocated buffers duplicated in new buffers.
7499 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { orig.clone() }
7501 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
7502 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
7503 /// A pointer to the contents in the success state.
7504 /// Reading from this pointer when `result_ok` is not set is undefined.
7505 pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
7506 /// A pointer to the contents in the error state.
7507 /// Reading from this pointer when `result_ok` is set is undefined.
7508 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7511 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
7512 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
7513 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7514 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
7515 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
7516 /// `err` or `result` depending on the state of `result_ok`.
7517 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
7518 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
7519 pub result_ok: bool,
7522 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
7523 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
7524 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
7525 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
7526 result: Box::into_raw(Box::new(o)),
7532 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
7533 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
7534 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
7535 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
7536 err: Box::into_raw(Box::new(e)),
7542 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
7543 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
7544 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
7545 fn drop(&mut self) {
7547 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7548 let _ = unsafe { Box::from_raw(self.contents.result) };
7551 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7552 let _ = unsafe { Box::from_raw(self.contents.err) };
7557 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
7558 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
7559 let contents = if o.result_ok {
7560 let result = unsafe { o.contents.result };
7561 unsafe { o.contents.result = std::ptr::null_mut() };
7562 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
7564 let err = unsafe { o.contents.err };
7565 unsafe { o.contents.err = std::ptr::null_mut(); }
7566 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
7570 result_ok: o.result_ok,
7574 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
7575 fn clone(&self) -> Self {
7577 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
7578 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
7581 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
7582 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7588 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
7589 /// but with all dynamically-allocated buffers duplicated in new buffers.
7590 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { orig.clone() }
7592 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
7593 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
7594 /// A pointer to the contents in the success state.
7595 /// Reading from this pointer when `result_ok` is not set is undefined.
7596 pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
7597 /// A pointer to the contents in the error state.
7598 /// Reading from this pointer when `result_ok` is set is undefined.
7599 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7602 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
7603 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
7604 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7605 pub struct CResult_QueryChannelRangeDecodeErrorZ {
7606 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
7607 /// `err` or `result` depending on the state of `result_ok`.
7608 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
7609 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
7610 pub result_ok: bool,
7613 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
7614 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
7615 CResult_QueryChannelRangeDecodeErrorZ {
7616 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
7617 result: Box::into_raw(Box::new(o)),
7623 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
7624 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
7625 CResult_QueryChannelRangeDecodeErrorZ {
7626 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
7627 err: Box::into_raw(Box::new(e)),
7633 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
7634 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
7635 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
7636 fn drop(&mut self) {
7638 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7639 let _ = unsafe { Box::from_raw(self.contents.result) };
7642 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7643 let _ = unsafe { Box::from_raw(self.contents.err) };
7648 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
7649 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
7650 let contents = if o.result_ok {
7651 let result = unsafe { o.contents.result };
7652 unsafe { o.contents.result = std::ptr::null_mut() };
7653 CResult_QueryChannelRangeDecodeErrorZPtr { result }
7655 let err = unsafe { o.contents.err };
7656 unsafe { o.contents.err = std::ptr::null_mut(); }
7657 CResult_QueryChannelRangeDecodeErrorZPtr { err }
7661 result_ok: o.result_ok,
7665 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
7666 fn clone(&self) -> Self {
7668 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
7669 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
7672 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
7673 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7679 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
7680 /// but with all dynamically-allocated buffers duplicated in new buffers.
7681 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { orig.clone() }
7683 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
7684 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
7685 /// A pointer to the contents in the success state.
7686 /// Reading from this pointer when `result_ok` is not set is undefined.
7687 pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
7688 /// A pointer to the contents in the error state.
7689 /// Reading from this pointer when `result_ok` is set is undefined.
7690 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7693 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
7694 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
7695 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7696 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
7697 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
7698 /// `err` or `result` depending on the state of `result_ok`.
7699 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
7700 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
7701 pub result_ok: bool,
7704 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
7705 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
7706 CResult_ReplyChannelRangeDecodeErrorZ {
7707 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
7708 result: Box::into_raw(Box::new(o)),
7714 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
7715 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
7716 CResult_ReplyChannelRangeDecodeErrorZ {
7717 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
7718 err: Box::into_raw(Box::new(e)),
7724 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
7725 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
7726 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
7727 fn drop(&mut self) {
7729 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7730 let _ = unsafe { Box::from_raw(self.contents.result) };
7733 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7734 let _ = unsafe { Box::from_raw(self.contents.err) };
7739 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
7740 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
7741 let contents = if o.result_ok {
7742 let result = unsafe { o.contents.result };
7743 unsafe { o.contents.result = std::ptr::null_mut() };
7744 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
7746 let err = unsafe { o.contents.err };
7747 unsafe { o.contents.err = std::ptr::null_mut(); }
7748 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
7752 result_ok: o.result_ok,
7756 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
7757 fn clone(&self) -> Self {
7759 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
7760 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
7763 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
7764 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7770 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
7771 /// but with all dynamically-allocated buffers duplicated in new buffers.
7772 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { orig.clone() }
7774 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
7775 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
7776 /// A pointer to the contents in the success state.
7777 /// Reading from this pointer when `result_ok` is not set is undefined.
7778 pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
7779 /// A pointer to the contents in the error state.
7780 /// Reading from this pointer when `result_ok` is set is undefined.
7781 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7784 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
7785 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
7786 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7787 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
7788 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
7789 /// `err` or `result` depending on the state of `result_ok`.
7790 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
7791 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
7792 pub result_ok: bool,
7795 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
7796 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
7797 CResult_GossipTimestampFilterDecodeErrorZ {
7798 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
7799 result: Box::into_raw(Box::new(o)),
7805 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
7806 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
7807 CResult_GossipTimestampFilterDecodeErrorZ {
7808 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
7809 err: Box::into_raw(Box::new(e)),
7815 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
7816 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
7817 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
7818 fn drop(&mut self) {
7820 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7821 let _ = unsafe { Box::from_raw(self.contents.result) };
7824 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7825 let _ = unsafe { Box::from_raw(self.contents.err) };
7830 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
7831 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
7832 let contents = if o.result_ok {
7833 let result = unsafe { o.contents.result };
7834 unsafe { o.contents.result = std::ptr::null_mut() };
7835 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
7837 let err = unsafe { o.contents.err };
7838 unsafe { o.contents.err = std::ptr::null_mut(); }
7839 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
7843 result_ok: o.result_ok,
7847 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
7848 fn clone(&self) -> Self {
7850 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
7851 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
7854 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
7855 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7861 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
7862 /// but with all dynamically-allocated buffers duplicated in new buffers.
7863 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { orig.clone() }
7865 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
7866 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
7867 /// A pointer to the contents in the success state.
7868 /// Reading from this pointer when `result_ok` is not set is undefined.
7869 pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
7870 /// A pointer to the contents in the error state.
7871 /// Reading from this pointer when `result_ok` is set is undefined.
7872 pub err: *mut crate::lightning::ln::msgs::DecodeError,
7875 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
7876 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
7877 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7878 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
7879 /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
7880 /// `err` or `result` depending on the state of `result_ok`.
7881 pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
7882 /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
7883 pub result_ok: bool,
7886 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
7887 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
7888 CResult_SpendableOutputDescriptorDecodeErrorZ {
7889 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
7890 result: Box::into_raw(Box::new(o)),
7896 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
7897 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
7898 CResult_SpendableOutputDescriptorDecodeErrorZ {
7899 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
7900 err: Box::into_raw(Box::new(e)),
7906 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
7907 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
7908 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
7909 fn drop(&mut self) {
7911 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7912 let _ = unsafe { Box::from_raw(self.contents.result) };
7915 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7916 let _ = unsafe { Box::from_raw(self.contents.err) };
7921 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
7922 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
7923 let contents = if o.result_ok {
7924 let result = unsafe { o.contents.result };
7925 unsafe { o.contents.result = std::ptr::null_mut() };
7926 CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
7928 let err = unsafe { o.contents.err };
7929 unsafe { o.contents.err = std::ptr::null_mut(); }
7930 CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
7934 result_ok: o.result_ok,
7938 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
7939 fn clone(&self) -> Self {
7941 Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
7942 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
7945 Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
7946 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7952 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
7953 /// but with all dynamically-allocated buffers duplicated in new buffers.
7954 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { orig.clone() }
7956 /// A tuple of 2 elements. See the individual fields for the types contained.
7957 pub struct C2Tuple_SignatureCVec_SignatureZZ {
7958 /// The element at position 0
7959 pub a: crate::c_types::Signature,
7960 /// The element at position 1
7961 pub b: crate::c_types::derived::CVec_SignatureZ,
7963 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
7964 fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
7971 impl C2Tuple_SignatureCVec_SignatureZZ {
7972 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
7976 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
7977 fn clone(&self) -> Self {
7985 /// Creates a new tuple which has the same data as `orig`
7986 /// but with all dynamically-allocated buffers duplicated in new buffers.
7987 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { orig.clone() }
7988 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
7990 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
7991 C2Tuple_SignatureCVec_SignatureZZ { a, b, }
7995 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
7996 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
7998 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
7999 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
8000 /// A pointer to the contents in the success state.
8001 /// Reading from this pointer when `result_ok` is not set is undefined.
8002 pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
8003 /// Note that this value is always NULL, as there are no contents in the Err variant
8004 pub err: *mut std::ffi::c_void,
8007 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
8008 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
8009 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8010 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
8011 /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
8012 /// `err` or `result` depending on the state of `result_ok`.
8013 pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
8014 /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
8015 pub result_ok: bool,
8018 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
8019 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
8020 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
8021 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
8022 result: Box::into_raw(Box::new(o)),
8028 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
8029 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
8030 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
8031 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
8032 err: std::ptr::null_mut(),
8038 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
8039 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
8040 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
8041 fn drop(&mut self) {
8043 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8044 let _ = unsafe { Box::from_raw(self.contents.result) };
8050 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, u8>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
8051 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, u8>) -> Self {
8052 let contents = if o.result_ok {
8053 let result = unsafe { o.contents.result };
8054 unsafe { o.contents.result = std::ptr::null_mut() };
8055 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
8057 let _ = unsafe { Box::from_raw(o.contents.err) };
8058 o.contents.err = std::ptr::null_mut();
8059 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: std::ptr::null_mut() }
8063 result_ok: o.result_ok,
8067 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
8068 fn clone(&self) -> Self {
8070 Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
8071 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
8074 Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
8075 err: std::ptr::null_mut()
8081 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
8082 /// but with all dynamically-allocated buffers duplicated in new buffers.
8083 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { orig.clone() }
8085 /// The contents of CResult_SignatureNoneZ
8086 pub union CResult_SignatureNoneZPtr {
8087 /// A pointer to the contents in the success state.
8088 /// Reading from this pointer when `result_ok` is not set is undefined.
8089 pub result: *mut crate::c_types::Signature,
8090 /// Note that this value is always NULL, as there are no contents in the Err variant
8091 pub err: *mut std::ffi::c_void,
8094 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
8095 /// containing a crate::c_types::Signature on success and a () on failure.
8096 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8097 pub struct CResult_SignatureNoneZ {
8098 /// The contents of this CResult_SignatureNoneZ, accessible via either
8099 /// `err` or `result` depending on the state of `result_ok`.
8100 pub contents: CResult_SignatureNoneZPtr,
8101 /// Whether this CResult_SignatureNoneZ represents a success state.
8102 pub result_ok: bool,
8105 /// Creates a new CResult_SignatureNoneZ in the success state.
8106 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
8107 CResult_SignatureNoneZ {
8108 contents: CResult_SignatureNoneZPtr {
8109 result: Box::into_raw(Box::new(o)),
8115 /// Creates a new CResult_SignatureNoneZ in the error state.
8116 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
8117 CResult_SignatureNoneZ {
8118 contents: CResult_SignatureNoneZPtr {
8119 err: std::ptr::null_mut(),
8125 /// Frees any resources used by the CResult_SignatureNoneZ.
8126 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
8127 impl Drop for CResult_SignatureNoneZ {
8128 fn drop(&mut self) {
8130 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8131 let _ = unsafe { Box::from_raw(self.contents.result) };
8137 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, u8>> for CResult_SignatureNoneZ {
8138 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, u8>) -> Self {
8139 let contents = if o.result_ok {
8140 let result = unsafe { o.contents.result };
8141 unsafe { o.contents.result = std::ptr::null_mut() };
8142 CResult_SignatureNoneZPtr { result }
8144 let _ = unsafe { Box::from_raw(o.contents.err) };
8145 o.contents.err = std::ptr::null_mut();
8146 CResult_SignatureNoneZPtr { err: std::ptr::null_mut() }
8150 result_ok: o.result_ok,
8154 impl Clone for CResult_SignatureNoneZ {
8155 fn clone(&self) -> Self {
8157 Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
8158 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
8161 Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
8162 err: std::ptr::null_mut()
8168 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
8169 /// but with all dynamically-allocated buffers duplicated in new buffers.
8170 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { orig.clone() }
8172 /// The contents of CResult_SignDecodeErrorZ
8173 pub union CResult_SignDecodeErrorZPtr {
8174 /// A pointer to the contents in the success state.
8175 /// Reading from this pointer when `result_ok` is not set is undefined.
8176 pub result: *mut crate::lightning::chain::keysinterface::Sign,
8177 /// A pointer to the contents in the error state.
8178 /// Reading from this pointer when `result_ok` is set is undefined.
8179 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8182 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
8183 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
8184 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8185 pub struct CResult_SignDecodeErrorZ {
8186 /// The contents of this CResult_SignDecodeErrorZ, accessible via either
8187 /// `err` or `result` depending on the state of `result_ok`.
8188 pub contents: CResult_SignDecodeErrorZPtr,
8189 /// Whether this CResult_SignDecodeErrorZ represents a success state.
8190 pub result_ok: bool,
8193 /// Creates a new CResult_SignDecodeErrorZ in the success state.
8194 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
8195 CResult_SignDecodeErrorZ {
8196 contents: CResult_SignDecodeErrorZPtr {
8197 result: Box::into_raw(Box::new(o)),
8203 /// Creates a new CResult_SignDecodeErrorZ in the error state.
8204 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
8205 CResult_SignDecodeErrorZ {
8206 contents: CResult_SignDecodeErrorZPtr {
8207 err: Box::into_raw(Box::new(e)),
8213 /// Frees any resources used by the CResult_SignDecodeErrorZ.
8214 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
8215 impl Drop for CResult_SignDecodeErrorZ {
8216 fn drop(&mut self) {
8218 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8219 let _ = unsafe { Box::from_raw(self.contents.result) };
8222 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8223 let _ = unsafe { Box::from_raw(self.contents.err) };
8228 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
8229 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
8230 let contents = if o.result_ok {
8231 let result = unsafe { o.contents.result };
8232 unsafe { o.contents.result = std::ptr::null_mut() };
8233 CResult_SignDecodeErrorZPtr { result }
8235 let err = unsafe { o.contents.err };
8236 unsafe { o.contents.err = std::ptr::null_mut(); }
8237 CResult_SignDecodeErrorZPtr { err }
8241 result_ok: o.result_ok,
8245 impl Clone for CResult_SignDecodeErrorZ {
8246 fn clone(&self) -> Self {
8248 Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
8249 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
8252 Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
8253 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8259 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
8260 /// but with all dynamically-allocated buffers duplicated in new buffers.
8261 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { orig.clone() }
8263 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
8264 /// This corresponds to std::vector in C++
8265 pub struct CVec_CVec_u8ZZ {
8266 /// The elements in the array.
8267 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8268 pub data: *mut crate::c_types::derived::CVec_u8Z,
8269 /// The number of elements pointed to by `data`.
8272 impl CVec_CVec_u8ZZ {
8273 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
8274 if self.datalen == 0 { return Vec::new(); }
8275 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8276 self.data = std::ptr::null_mut();
8280 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
8281 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8284 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
8285 fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
8286 let datalen = v.len();
8287 let data = Box::into_raw(v.into_boxed_slice());
8288 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8292 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8293 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
8294 impl Drop for CVec_CVec_u8ZZ {
8295 fn drop(&mut self) {
8296 if self.datalen == 0 { return; }
8297 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8300 impl Clone for CVec_CVec_u8ZZ {
8301 fn clone(&self) -> Self {
8302 let mut res = Vec::new();
8303 if self.datalen == 0 { return Self::from(res); }
8304 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8309 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
8310 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
8311 /// A pointer to the contents in the success state.
8312 /// Reading from this pointer when `result_ok` is not set is undefined.
8313 pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
8314 /// Note that this value is always NULL, as there are no contents in the Err variant
8315 pub err: *mut std::ffi::c_void,
8318 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
8319 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
8320 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8321 pub struct CResult_CVec_CVec_u8ZZNoneZ {
8322 /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
8323 /// `err` or `result` depending on the state of `result_ok`.
8324 pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
8325 /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
8326 pub result_ok: bool,
8329 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
8330 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
8331 CResult_CVec_CVec_u8ZZNoneZ {
8332 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
8333 result: Box::into_raw(Box::new(o)),
8339 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
8340 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
8341 CResult_CVec_CVec_u8ZZNoneZ {
8342 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
8343 err: std::ptr::null_mut(),
8349 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
8350 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
8351 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
8352 fn drop(&mut self) {
8354 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8355 let _ = unsafe { Box::from_raw(self.contents.result) };
8361 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, u8>> for CResult_CVec_CVec_u8ZZNoneZ {
8362 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, u8>) -> Self {
8363 let contents = if o.result_ok {
8364 let result = unsafe { o.contents.result };
8365 unsafe { o.contents.result = std::ptr::null_mut() };
8366 CResult_CVec_CVec_u8ZZNoneZPtr { result }
8368 let _ = unsafe { Box::from_raw(o.contents.err) };
8369 o.contents.err = std::ptr::null_mut();
8370 CResult_CVec_CVec_u8ZZNoneZPtr { err: std::ptr::null_mut() }
8374 result_ok: o.result_ok,
8378 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
8379 fn clone(&self) -> Self {
8381 Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
8382 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
8385 Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
8386 err: std::ptr::null_mut()
8392 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
8393 /// but with all dynamically-allocated buffers duplicated in new buffers.
8394 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { orig.clone() }
8396 /// The contents of CResult_InMemorySignerDecodeErrorZ
8397 pub union CResult_InMemorySignerDecodeErrorZPtr {
8398 /// A pointer to the contents in the success state.
8399 /// Reading from this pointer when `result_ok` is not set is undefined.
8400 pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
8401 /// A pointer to the contents in the error state.
8402 /// Reading from this pointer when `result_ok` is set is undefined.
8403 pub err: *mut crate::lightning::ln::msgs::DecodeError,
8406 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
8407 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
8408 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8409 pub struct CResult_InMemorySignerDecodeErrorZ {
8410 /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
8411 /// `err` or `result` depending on the state of `result_ok`.
8412 pub contents: CResult_InMemorySignerDecodeErrorZPtr,
8413 /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
8414 pub result_ok: bool,
8417 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
8418 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
8419 CResult_InMemorySignerDecodeErrorZ {
8420 contents: CResult_InMemorySignerDecodeErrorZPtr {
8421 result: Box::into_raw(Box::new(o)),
8427 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
8428 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
8429 CResult_InMemorySignerDecodeErrorZ {
8430 contents: CResult_InMemorySignerDecodeErrorZPtr {
8431 err: Box::into_raw(Box::new(e)),
8437 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
8438 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
8439 impl Drop for CResult_InMemorySignerDecodeErrorZ {
8440 fn drop(&mut self) {
8442 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8443 let _ = unsafe { Box::from_raw(self.contents.result) };
8446 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8447 let _ = unsafe { Box::from_raw(self.contents.err) };
8452 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
8453 fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
8454 let contents = if o.result_ok {
8455 let result = unsafe { o.contents.result };
8456 unsafe { o.contents.result = std::ptr::null_mut() };
8457 CResult_InMemorySignerDecodeErrorZPtr { result }
8459 let err = unsafe { o.contents.err };
8460 unsafe { o.contents.err = std::ptr::null_mut(); }
8461 CResult_InMemorySignerDecodeErrorZPtr { err }
8465 result_ok: o.result_ok,
8469 impl Clone for CResult_InMemorySignerDecodeErrorZ {
8470 fn clone(&self) -> Self {
8472 Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
8473 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
8476 Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
8477 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8483 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
8484 /// but with all dynamically-allocated buffers duplicated in new buffers.
8485 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { orig.clone() }
8487 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
8488 /// This corresponds to std::vector in C++
8489 pub struct CVec_TxOutZ {
8490 /// The elements in the array.
8491 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8492 pub data: *mut crate::c_types::TxOut,
8493 /// The number of elements pointed to by `data`.
8497 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
8498 if self.datalen == 0 { return Vec::new(); }
8499 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8500 self.data = std::ptr::null_mut();
8504 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
8505 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8508 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
8509 fn from(v: Vec<crate::c_types::TxOut>) -> Self {
8510 let datalen = v.len();
8511 let data = Box::into_raw(v.into_boxed_slice());
8512 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8516 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8517 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
8518 impl Drop for CVec_TxOutZ {
8519 fn drop(&mut self) {
8520 if self.datalen == 0 { return; }
8521 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8524 impl Clone for CVec_TxOutZ {
8525 fn clone(&self) -> Self {
8526 let mut res = Vec::new();
8527 if self.datalen == 0 { return Self::from(res); }
8528 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8533 /// The contents of CResult_TransactionNoneZ
8534 pub union CResult_TransactionNoneZPtr {
8535 /// A pointer to the contents in the success state.
8536 /// Reading from this pointer when `result_ok` is not set is undefined.
8537 pub result: *mut crate::c_types::Transaction,
8538 /// Note that this value is always NULL, as there are no contents in the Err variant
8539 pub err: *mut std::ffi::c_void,
8542 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
8543 /// containing a crate::c_types::Transaction on success and a () on failure.
8544 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8545 pub struct CResult_TransactionNoneZ {
8546 /// The contents of this CResult_TransactionNoneZ, accessible via either
8547 /// `err` or `result` depending on the state of `result_ok`.
8548 pub contents: CResult_TransactionNoneZPtr,
8549 /// Whether this CResult_TransactionNoneZ represents a success state.
8550 pub result_ok: bool,
8553 /// Creates a new CResult_TransactionNoneZ in the success state.
8554 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
8555 CResult_TransactionNoneZ {
8556 contents: CResult_TransactionNoneZPtr {
8557 result: Box::into_raw(Box::new(o)),
8563 /// Creates a new CResult_TransactionNoneZ in the error state.
8564 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
8565 CResult_TransactionNoneZ {
8566 contents: CResult_TransactionNoneZPtr {
8567 err: std::ptr::null_mut(),
8573 /// Frees any resources used by the CResult_TransactionNoneZ.
8574 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
8575 impl Drop for CResult_TransactionNoneZ {
8576 fn drop(&mut self) {
8578 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8579 let _ = unsafe { Box::from_raw(self.contents.result) };
8585 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, u8>> for CResult_TransactionNoneZ {
8586 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, u8>) -> Self {
8587 let contents = if o.result_ok {
8588 let result = unsafe { o.contents.result };
8589 unsafe { o.contents.result = std::ptr::null_mut() };
8590 CResult_TransactionNoneZPtr { result }
8592 let _ = unsafe { Box::from_raw(o.contents.err) };
8593 o.contents.err = std::ptr::null_mut();
8594 CResult_TransactionNoneZPtr { err: std::ptr::null_mut() }
8598 result_ok: o.result_ok,
8603 /// The contents of CResult_NoneErrorZ
8604 pub union CResult_NoneErrorZPtr {
8605 /// Note that this value is always NULL, as there are no contents in the OK variant
8606 pub result: *mut std::ffi::c_void,
8607 /// A pointer to the contents in the error state.
8608 /// Reading from this pointer when `result_ok` is set is undefined.
8609 pub err: *mut crate::c_types::IOError,
8612 /// A CResult_NoneErrorZ represents the result of a fallible operation,
8613 /// containing a () on success and a crate::c_types::IOError on failure.
8614 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8615 pub struct CResult_NoneErrorZ {
8616 /// The contents of this CResult_NoneErrorZ, accessible via either
8617 /// `err` or `result` depending on the state of `result_ok`.
8618 pub contents: CResult_NoneErrorZPtr,
8619 /// Whether this CResult_NoneErrorZ represents a success state.
8620 pub result_ok: bool,
8623 /// Creates a new CResult_NoneErrorZ in the success state.
8624 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
8625 CResult_NoneErrorZ {
8626 contents: CResult_NoneErrorZPtr {
8627 result: std::ptr::null_mut(),
8633 /// Creates a new CResult_NoneErrorZ in the error state.
8634 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
8635 CResult_NoneErrorZ {
8636 contents: CResult_NoneErrorZPtr {
8637 err: Box::into_raw(Box::new(e)),
8643 /// Frees any resources used by the CResult_NoneErrorZ.
8644 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
8645 impl Drop for CResult_NoneErrorZ {
8646 fn drop(&mut self) {
8649 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8650 let _ = unsafe { Box::from_raw(self.contents.err) };
8655 impl From<crate::c_types::CResultTempl<u8, crate::c_types::IOError>> for CResult_NoneErrorZ {
8656 fn from(mut o: crate::c_types::CResultTempl<u8, crate::c_types::IOError>) -> Self {
8657 let contents = if o.result_ok {
8658 let _ = unsafe { Box::from_raw(o.contents.result) };
8659 o.contents.result = std::ptr::null_mut();
8660 CResult_NoneErrorZPtr { result: std::ptr::null_mut() }
8662 let err = unsafe { o.contents.err };
8663 unsafe { o.contents.err = std::ptr::null_mut(); }
8664 CResult_NoneErrorZPtr { err }
8668 result_ok: o.result_ok,
8673 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
8674 /// This corresponds to std::vector in C++
8675 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
8676 /// The elements in the array.
8677 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8678 pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
8679 /// The number of elements pointed to by `data`.
8682 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
8683 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
8684 if self.datalen == 0 { return Vec::new(); }
8685 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8686 self.data = std::ptr::null_mut();
8690 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
8691 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8694 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
8695 fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
8696 let datalen = v.len();
8697 let data = Box::into_raw(v.into_boxed_slice());
8698 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8702 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8703 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
8704 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
8705 fn drop(&mut self) {
8706 if self.datalen == 0 { return; }
8707 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8711 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
8712 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
8713 /// A pointer to the contents in the success state.
8714 /// Reading from this pointer when `result_ok` is not set is undefined.
8715 pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
8716 /// A pointer to the contents in the error state.
8717 /// Reading from this pointer when `result_ok` is set is undefined.
8718 pub err: *mut crate::c_types::IOError,
8721 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
8722 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
8723 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8724 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8725 /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
8726 /// `err` or `result` depending on the state of `result_ok`.
8727 pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
8728 /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
8729 pub result_ok: bool,
8732 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
8733 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8734 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8735 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
8736 result: Box::into_raw(Box::new(o)),
8742 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
8743 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8744 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8745 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
8746 err: Box::into_raw(Box::new(e)),
8752 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
8753 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
8754 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8755 fn drop(&mut self) {
8757 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8758 let _ = unsafe { Box::from_raw(self.contents.result) };
8761 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8762 let _ = unsafe { Box::from_raw(self.contents.err) };
8767 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
8768 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
8769 let contents = if o.result_ok {
8770 let result = unsafe { o.contents.result };
8771 unsafe { o.contents.result = std::ptr::null_mut() };
8772 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
8774 let err = unsafe { o.contents.err };
8775 unsafe { o.contents.err = std::ptr::null_mut(); }
8776 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
8780 result_ok: o.result_ok,
8785 /// The contents of CResult_NoneAPIErrorZ
8786 pub union CResult_NoneAPIErrorZPtr {
8787 /// Note that this value is always NULL, as there are no contents in the OK variant
8788 pub result: *mut std::ffi::c_void,
8789 /// A pointer to the contents in the error state.
8790 /// Reading from this pointer when `result_ok` is set is undefined.
8791 pub err: *mut crate::lightning::util::errors::APIError,
8794 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
8795 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
8796 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8797 pub struct CResult_NoneAPIErrorZ {
8798 /// The contents of this CResult_NoneAPIErrorZ, accessible via either
8799 /// `err` or `result` depending on the state of `result_ok`.
8800 pub contents: CResult_NoneAPIErrorZPtr,
8801 /// Whether this CResult_NoneAPIErrorZ represents a success state.
8802 pub result_ok: bool,
8805 /// Creates a new CResult_NoneAPIErrorZ in the success state.
8806 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
8807 CResult_NoneAPIErrorZ {
8808 contents: CResult_NoneAPIErrorZPtr {
8809 result: std::ptr::null_mut(),
8815 /// Creates a new CResult_NoneAPIErrorZ in the error state.
8816 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
8817 CResult_NoneAPIErrorZ {
8818 contents: CResult_NoneAPIErrorZPtr {
8819 err: Box::into_raw(Box::new(e)),
8825 /// Frees any resources used by the CResult_NoneAPIErrorZ.
8826 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
8827 impl Drop for CResult_NoneAPIErrorZ {
8828 fn drop(&mut self) {
8831 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8832 let _ = unsafe { Box::from_raw(self.contents.err) };
8837 impl From<crate::c_types::CResultTempl<u8, crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
8838 fn from(mut o: crate::c_types::CResultTempl<u8, crate::lightning::util::errors::APIError>) -> Self {
8839 let contents = if o.result_ok {
8840 let _ = unsafe { Box::from_raw(o.contents.result) };
8841 o.contents.result = std::ptr::null_mut();
8842 CResult_NoneAPIErrorZPtr { result: std::ptr::null_mut() }
8844 let err = unsafe { o.contents.err };
8845 unsafe { o.contents.err = std::ptr::null_mut(); }
8846 CResult_NoneAPIErrorZPtr { err }
8850 result_ok: o.result_ok,
8854 impl Clone for CResult_NoneAPIErrorZ {
8855 fn clone(&self) -> Self {
8857 Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
8858 result: std::ptr::null_mut()
8861 Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
8862 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8868 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
8869 /// but with all dynamically-allocated buffers duplicated in new buffers.
8870 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { orig.clone() }
8872 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
8873 /// This corresponds to std::vector in C++
8874 pub struct CVec_CResult_NoneAPIErrorZZ {
8875 /// The elements in the array.
8876 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8877 pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
8878 /// The number of elements pointed to by `data`.
8881 impl CVec_CResult_NoneAPIErrorZZ {
8882 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
8883 if self.datalen == 0 { return Vec::new(); }
8884 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8885 self.data = std::ptr::null_mut();
8889 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
8890 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8893 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
8894 fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
8895 let datalen = v.len();
8896 let data = Box::into_raw(v.into_boxed_slice());
8897 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8901 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8902 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
8903 impl Drop for CVec_CResult_NoneAPIErrorZZ {
8904 fn drop(&mut self) {
8905 if self.datalen == 0 { return; }
8906 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8909 impl Clone for CVec_CResult_NoneAPIErrorZZ {
8910 fn clone(&self) -> Self {
8911 let mut res = Vec::new();
8912 if self.datalen == 0 { return Self::from(res); }
8913 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8918 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
8919 /// This corresponds to std::vector in C++
8920 pub struct CVec_APIErrorZ {
8921 /// The elements in the array.
8922 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8923 pub data: *mut crate::lightning::util::errors::APIError,
8924 /// The number of elements pointed to by `data`.
8927 impl CVec_APIErrorZ {
8928 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
8929 if self.datalen == 0 { return Vec::new(); }
8930 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8931 self.data = std::ptr::null_mut();
8935 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
8936 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
8939 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
8940 fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
8941 let datalen = v.len();
8942 let data = Box::into_raw(v.into_boxed_slice());
8943 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8947 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8948 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
8949 impl Drop for CVec_APIErrorZ {
8950 fn drop(&mut self) {
8951 if self.datalen == 0 { return; }
8952 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
8955 impl Clone for CVec_APIErrorZ {
8956 fn clone(&self) -> Self {
8957 let mut res = Vec::new();
8958 if self.datalen == 0 { return Self::from(res); }
8959 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
8964 /// The contents of CResult_NonePaymentSendFailureZ
8965 pub union CResult_NonePaymentSendFailureZPtr {
8966 /// Note that this value is always NULL, as there are no contents in the OK variant
8967 pub result: *mut std::ffi::c_void,
8968 /// A pointer to the contents in the error state.
8969 /// Reading from this pointer when `result_ok` is set is undefined.
8970 pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
8973 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
8974 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
8975 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8976 pub struct CResult_NonePaymentSendFailureZ {
8977 /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
8978 /// `err` or `result` depending on the state of `result_ok`.
8979 pub contents: CResult_NonePaymentSendFailureZPtr,
8980 /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
8981 pub result_ok: bool,
8984 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
8985 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
8986 CResult_NonePaymentSendFailureZ {
8987 contents: CResult_NonePaymentSendFailureZPtr {
8988 result: std::ptr::null_mut(),
8994 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
8995 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
8996 CResult_NonePaymentSendFailureZ {
8997 contents: CResult_NonePaymentSendFailureZPtr {
8998 err: Box::into_raw(Box::new(e)),
9004 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
9005 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
9006 impl Drop for CResult_NonePaymentSendFailureZ {
9007 fn drop(&mut self) {
9010 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9011 let _ = unsafe { Box::from_raw(self.contents.err) };
9016 impl From<crate::c_types::CResultTempl<u8, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
9017 fn from(mut o: crate::c_types::CResultTempl<u8, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
9018 let contents = if o.result_ok {
9019 let _ = unsafe { Box::from_raw(o.contents.result) };
9020 o.contents.result = std::ptr::null_mut();
9021 CResult_NonePaymentSendFailureZPtr { result: std::ptr::null_mut() }
9023 let err = unsafe { o.contents.err };
9024 unsafe { o.contents.err = std::ptr::null_mut(); }
9025 CResult_NonePaymentSendFailureZPtr { err }
9029 result_ok: o.result_ok,
9033 impl Clone for CResult_NonePaymentSendFailureZ {
9034 fn clone(&self) -> Self {
9036 Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
9037 result: std::ptr::null_mut()
9040 Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
9041 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
9047 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
9048 /// but with all dynamically-allocated buffers duplicated in new buffers.
9049 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { orig.clone() }
9051 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
9052 /// This corresponds to std::vector in C++
9053 pub struct CVec_ChannelMonitorZ {
9054 /// The elements in the array.
9055 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9056 pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
9057 /// The number of elements pointed to by `data`.
9060 impl CVec_ChannelMonitorZ {
9061 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
9062 if self.datalen == 0 { return Vec::new(); }
9063 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9064 self.data = std::ptr::null_mut();
9068 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
9069 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
9072 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
9073 fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
9074 let datalen = v.len();
9075 let data = Box::into_raw(v.into_boxed_slice());
9076 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9080 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9081 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
9082 impl Drop for CVec_ChannelMonitorZ {
9083 fn drop(&mut self) {
9084 if self.datalen == 0 { return; }
9085 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
9089 /// A tuple of 2 elements. See the individual fields for the types contained.
9090 pub struct C2Tuple_BlockHashChannelManagerZ {
9091 /// The element at position 0
9092 pub a: crate::c_types::ThirtyTwoBytes,
9093 /// The element at position 1
9094 pub b: crate::lightning::ln::channelmanager::ChannelManager,
9096 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
9097 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
9104 impl C2Tuple_BlockHashChannelManagerZ {
9105 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
9109 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
9111 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
9112 C2Tuple_BlockHashChannelManagerZ { a, b, }
9116 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
9117 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
9119 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
9120 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9121 /// A pointer to the contents in the success state.
9122 /// Reading from this pointer when `result_ok` is not set is undefined.
9123 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
9124 /// A pointer to the contents in the error state.
9125 /// Reading from this pointer when `result_ok` is set is undefined.
9126 pub err: *mut crate::lightning::ln::msgs::DecodeError,
9129 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
9130 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9131 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9132 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9133 /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
9134 /// `err` or `result` depending on the state of `result_ok`.
9135 pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
9136 /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
9137 pub result_ok: bool,
9140 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
9141 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9142 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9143 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9144 result: Box::into_raw(Box::new(o)),
9150 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
9151 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9152 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9153 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9154 err: Box::into_raw(Box::new(e)),
9160 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
9161 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
9162 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9163 fn drop(&mut self) {
9165 if unsafe { !(self.contents.result as *mut ()).is_null() } {
9166 let _ = unsafe { Box::from_raw(self.contents.result) };
9169 if unsafe { !(self.contents.err as *mut ()).is_null() } {
9170 let _ = unsafe { Box::from_raw(self.contents.err) };
9175 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9176 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9177 let contents = if o.result_ok {
9178 let result = unsafe { o.contents.result };
9179 unsafe { o.contents.result = std::ptr::null_mut() };
9180 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
9182 let err = unsafe { o.contents.err };
9183 unsafe { o.contents.err = std::ptr::null_mut(); }
9184 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
9188 result_ok: o.result_ok,