2 /// The contents of CResult_SecretKeyErrorZ
3 pub union CResult_SecretKeyErrorZPtr {
4 /// A pointer to the contents in the success state.
5 /// Reading from this pointer when `result_ok` is not set is undefined.
6 pub result: *mut crate::c_types::SecretKey,
7 /// A pointer to the contents in the error state.
8 /// Reading from this pointer when `result_ok` is set is undefined.
9 pub err: *mut crate::c_types::Secp256k1Error,
12 /// A CResult_SecretKeyErrorZ represents the result of a fallible operation,
13 /// containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
14 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15 pub struct CResult_SecretKeyErrorZ {
16 /// The contents of this CResult_SecretKeyErrorZ, accessible via either
17 /// `err` or `result` depending on the state of `result_ok`.
18 pub contents: CResult_SecretKeyErrorZPtr,
19 /// Whether this CResult_SecretKeyErrorZ represents a success state.
23 /// Creates a new CResult_SecretKeyErrorZ in the success state.
24 pub extern "C" fn CResult_SecretKeyErrorZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyErrorZ {
25 CResult_SecretKeyErrorZ {
26 contents: CResult_SecretKeyErrorZPtr {
27 result: Box::into_raw(Box::new(o)),
33 /// Creates a new CResult_SecretKeyErrorZ in the error state.
34 pub extern "C" fn CResult_SecretKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_SecretKeyErrorZ {
35 CResult_SecretKeyErrorZ {
36 contents: CResult_SecretKeyErrorZPtr {
37 err: Box::into_raw(Box::new(e)),
43 /// Frees any resources used by the CResult_SecretKeyErrorZ.
44 pub extern "C" fn CResult_SecretKeyErrorZ_free(_res: CResult_SecretKeyErrorZ) { }
45 impl Drop for CResult_SecretKeyErrorZ {
48 if unsafe { !(self.contents.result as *mut ()).is_null() } {
49 let _ = unsafe { Box::from_raw(self.contents.result) };
52 if unsafe { !(self.contents.err as *mut ()).is_null() } {
53 let _ = unsafe { Box::from_raw(self.contents.err) };
58 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>> for CResult_SecretKeyErrorZ {
59 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>) -> Self {
60 let contents = if o.result_ok {
61 let result = unsafe { o.contents.result };
62 unsafe { o.contents.result = std::ptr::null_mut() };
63 CResult_SecretKeyErrorZPtr { result }
65 let err = unsafe { o.contents.err };
66 unsafe { o.contents.err = std::ptr::null_mut(); }
67 CResult_SecretKeyErrorZPtr { err }
71 result_ok: o.result_ok,
76 /// The contents of CResult_PublicKeyErrorZ
77 pub union CResult_PublicKeyErrorZPtr {
78 /// A pointer to the contents in the success state.
79 /// Reading from this pointer when `result_ok` is not set is undefined.
80 pub result: *mut crate::c_types::PublicKey,
81 /// A pointer to the contents in the error state.
82 /// Reading from this pointer when `result_ok` is set is undefined.
83 pub err: *mut crate::c_types::Secp256k1Error,
86 /// A CResult_PublicKeyErrorZ represents the result of a fallible operation,
87 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
88 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
89 pub struct CResult_PublicKeyErrorZ {
90 /// The contents of this CResult_PublicKeyErrorZ, accessible via either
91 /// `err` or `result` depending on the state of `result_ok`.
92 pub contents: CResult_PublicKeyErrorZPtr,
93 /// Whether this CResult_PublicKeyErrorZ represents a success state.
97 /// Creates a new CResult_PublicKeyErrorZ in the success state.
98 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
99 CResult_PublicKeyErrorZ {
100 contents: CResult_PublicKeyErrorZPtr {
101 result: Box::into_raw(Box::new(o)),
107 /// Creates a new CResult_PublicKeyErrorZ in the error state.
108 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
109 CResult_PublicKeyErrorZ {
110 contents: CResult_PublicKeyErrorZPtr {
111 err: Box::into_raw(Box::new(e)),
117 /// Frees any resources used by the CResult_PublicKeyErrorZ.
118 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
119 impl Drop for CResult_PublicKeyErrorZ {
122 if unsafe { !(self.contents.result as *mut ()).is_null() } {
123 let _ = unsafe { Box::from_raw(self.contents.result) };
126 if unsafe { !(self.contents.err as *mut ()).is_null() } {
127 let _ = unsafe { Box::from_raw(self.contents.err) };
132 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
133 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
134 let contents = if o.result_ok {
135 let result = unsafe { o.contents.result };
136 unsafe { o.contents.result = std::ptr::null_mut() };
137 CResult_PublicKeyErrorZPtr { result }
139 let err = unsafe { o.contents.err };
140 unsafe { o.contents.err = std::ptr::null_mut(); }
141 CResult_PublicKeyErrorZPtr { err }
145 result_ok: o.result_ok,
150 /// The contents of CResult_TxCreationKeysDecodeErrorZ
151 pub union CResult_TxCreationKeysDecodeErrorZPtr {
152 /// A pointer to the contents in the success state.
153 /// Reading from this pointer when `result_ok` is not set is undefined.
154 pub result: *mut crate::ln::chan_utils::TxCreationKeys,
155 /// A pointer to the contents in the error state.
156 /// Reading from this pointer when `result_ok` is set is undefined.
157 pub err: *mut crate::ln::msgs::DecodeError,
160 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
161 /// containing a crate::ln::chan_utils::TxCreationKeys on success and a crate::ln::msgs::DecodeError on failure.
162 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
163 pub struct CResult_TxCreationKeysDecodeErrorZ {
164 /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
165 /// `err` or `result` depending on the state of `result_ok`.
166 pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
167 /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
171 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
172 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
173 CResult_TxCreationKeysDecodeErrorZ {
174 contents: CResult_TxCreationKeysDecodeErrorZPtr {
175 result: Box::into_raw(Box::new(o)),
181 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
182 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
183 CResult_TxCreationKeysDecodeErrorZ {
184 contents: CResult_TxCreationKeysDecodeErrorZPtr {
185 err: Box::into_raw(Box::new(e)),
191 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
192 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
193 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
196 if unsafe { !(self.contents.result as *mut ()).is_null() } {
197 let _ = unsafe { Box::from_raw(self.contents.result) };
200 if unsafe { !(self.contents.err as *mut ()).is_null() } {
201 let _ = unsafe { Box::from_raw(self.contents.err) };
206 impl From<crate::c_types::CResultTempl<crate::ln::chan_utils::TxCreationKeys, crate::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
207 fn from(mut o: crate::c_types::CResultTempl<crate::ln::chan_utils::TxCreationKeys, crate::ln::msgs::DecodeError>) -> Self {
208 let contents = if o.result_ok {
209 let result = unsafe { o.contents.result };
210 unsafe { o.contents.result = std::ptr::null_mut() };
211 CResult_TxCreationKeysDecodeErrorZPtr { result }
213 let err = unsafe { o.contents.err };
214 unsafe { o.contents.err = std::ptr::null_mut(); }
215 CResult_TxCreationKeysDecodeErrorZPtr { err }
219 result_ok: o.result_ok,
223 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
224 fn clone(&self) -> Self {
226 Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
227 result: Box::into_raw(Box::new(<crate::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
230 Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
231 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
237 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
238 /// but with all dynamically-allocated buffers duplicated in new buffers.
239 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { orig.clone() }
241 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
242 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
243 /// A pointer to the contents in the success state.
244 /// Reading from this pointer when `result_ok` is not set is undefined.
245 pub result: *mut crate::ln::chan_utils::ChannelPublicKeys,
246 /// A pointer to the contents in the error state.
247 /// Reading from this pointer when `result_ok` is set is undefined.
248 pub err: *mut crate::ln::msgs::DecodeError,
251 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
252 /// containing a crate::ln::chan_utils::ChannelPublicKeys on success and a crate::ln::msgs::DecodeError on failure.
253 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
254 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
255 /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
256 /// `err` or `result` depending on the state of `result_ok`.
257 pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
258 /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
262 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
263 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
264 CResult_ChannelPublicKeysDecodeErrorZ {
265 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
266 result: Box::into_raw(Box::new(o)),
272 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
273 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
274 CResult_ChannelPublicKeysDecodeErrorZ {
275 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
276 err: Box::into_raw(Box::new(e)),
282 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
283 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
284 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
287 if unsafe { !(self.contents.result as *mut ()).is_null() } {
288 let _ = unsafe { Box::from_raw(self.contents.result) };
291 if unsafe { !(self.contents.err as *mut ()).is_null() } {
292 let _ = unsafe { Box::from_raw(self.contents.err) };
297 impl From<crate::c_types::CResultTempl<crate::ln::chan_utils::ChannelPublicKeys, crate::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
298 fn from(mut o: crate::c_types::CResultTempl<crate::ln::chan_utils::ChannelPublicKeys, crate::ln::msgs::DecodeError>) -> Self {
299 let contents = if o.result_ok {
300 let result = unsafe { o.contents.result };
301 unsafe { o.contents.result = std::ptr::null_mut() };
302 CResult_ChannelPublicKeysDecodeErrorZPtr { result }
304 let err = unsafe { o.contents.err };
305 unsafe { o.contents.err = std::ptr::null_mut(); }
306 CResult_ChannelPublicKeysDecodeErrorZPtr { err }
310 result_ok: o.result_ok,
314 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
315 fn clone(&self) -> Self {
317 Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
318 result: Box::into_raw(Box::new(<crate::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
321 Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
322 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
328 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
329 /// but with all dynamically-allocated buffers duplicated in new buffers.
330 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { orig.clone() }
332 /// The contents of CResult_TxCreationKeysErrorZ
333 pub union CResult_TxCreationKeysErrorZPtr {
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::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::c_types::Secp256k1Error,
342 /// A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
343 /// containing a crate::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
344 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
345 pub struct CResult_TxCreationKeysErrorZ {
346 /// The contents of this CResult_TxCreationKeysErrorZ, accessible via either
347 /// `err` or `result` depending on the state of `result_ok`.
348 pub contents: CResult_TxCreationKeysErrorZPtr,
349 /// Whether this CResult_TxCreationKeysErrorZ represents a success state.
353 /// Creates a new CResult_TxCreationKeysErrorZ in the success state.
354 pub extern "C" fn CResult_TxCreationKeysErrorZ_ok(o: crate::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysErrorZ {
355 CResult_TxCreationKeysErrorZ {
356 contents: CResult_TxCreationKeysErrorZPtr {
357 result: Box::into_raw(Box::new(o)),
363 /// Creates a new CResult_TxCreationKeysErrorZ in the error state.
364 pub extern "C" fn CResult_TxCreationKeysErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_TxCreationKeysErrorZ {
365 CResult_TxCreationKeysErrorZ {
366 contents: CResult_TxCreationKeysErrorZPtr {
367 err: Box::into_raw(Box::new(e)),
373 /// Frees any resources used by the CResult_TxCreationKeysErrorZ.
374 pub extern "C" fn CResult_TxCreationKeysErrorZ_free(_res: CResult_TxCreationKeysErrorZ) { }
375 impl Drop for CResult_TxCreationKeysErrorZ {
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::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>> for CResult_TxCreationKeysErrorZ {
389 fn from(mut o: crate::c_types::CResultTempl<crate::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>) -> 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_TxCreationKeysErrorZPtr { result }
395 let err = unsafe { o.contents.err };
396 unsafe { o.contents.err = std::ptr::null_mut(); }
397 CResult_TxCreationKeysErrorZPtr { err }
401 result_ok: o.result_ok,
407 /// An enum which can either contain a u32 or not
408 pub enum COption_u32Z {
409 /// When we're in this state, this COption_u32Z contains a u32
411 /// When we're in this state, this COption_u32Z contains nothing
415 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
416 if let Self::Some(_) = self { true } else { false }
418 #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
419 if let Self::Some(v) = self { v } else { unreachable!() }
423 /// Constructs a new COption_u32Z containing a u32
424 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
425 COption_u32Z::Some(o)
428 /// Constructs a new COption_u32Z containing nothing
429 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
433 /// Frees any resources associated with the u32, if we are in the Some state
434 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
436 /// Creates a new COption_u32Z which has the same data as `orig`
437 /// but with all dynamically-allocated buffers duplicated in new buffers.
438 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { orig.clone() }
440 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
441 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
442 /// A pointer to the contents in the success state.
443 /// Reading from this pointer when `result_ok` is not set is undefined.
444 pub result: *mut crate::ln::chan_utils::HTLCOutputInCommitment,
445 /// A pointer to the contents in the error state.
446 /// Reading from this pointer when `result_ok` is set is undefined.
447 pub err: *mut crate::ln::msgs::DecodeError,
450 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
451 /// containing a crate::ln::chan_utils::HTLCOutputInCommitment on success and a crate::ln::msgs::DecodeError on failure.
452 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
453 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
454 /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
455 /// `err` or `result` depending on the state of `result_ok`.
456 pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
457 /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
461 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
462 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
463 CResult_HTLCOutputInCommitmentDecodeErrorZ {
464 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
465 result: Box::into_raw(Box::new(o)),
471 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
472 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
473 CResult_HTLCOutputInCommitmentDecodeErrorZ {
474 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
475 err: Box::into_raw(Box::new(e)),
481 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
482 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
483 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
486 if unsafe { !(self.contents.result as *mut ()).is_null() } {
487 let _ = unsafe { Box::from_raw(self.contents.result) };
490 if unsafe { !(self.contents.err as *mut ()).is_null() } {
491 let _ = unsafe { Box::from_raw(self.contents.err) };
496 impl From<crate::c_types::CResultTempl<crate::ln::chan_utils::HTLCOutputInCommitment, crate::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
497 fn from(mut o: crate::c_types::CResultTempl<crate::ln::chan_utils::HTLCOutputInCommitment, crate::ln::msgs::DecodeError>) -> Self {
498 let contents = if o.result_ok {
499 let result = unsafe { o.contents.result };
500 unsafe { o.contents.result = std::ptr::null_mut() };
501 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
503 let err = unsafe { o.contents.err };
504 unsafe { o.contents.err = std::ptr::null_mut(); }
505 CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
509 result_ok: o.result_ok,
513 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
514 fn clone(&self) -> Self {
516 Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
517 result: Box::into_raw(Box::new(<crate::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
520 Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
521 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
527 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
528 /// but with all dynamically-allocated buffers duplicated in new buffers.
529 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { orig.clone() }
531 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
532 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
533 /// A pointer to the contents in the success state.
534 /// Reading from this pointer when `result_ok` is not set is undefined.
535 pub result: *mut crate::ln::chan_utils::CounterpartyChannelTransactionParameters,
536 /// A pointer to the contents in the error state.
537 /// Reading from this pointer when `result_ok` is set is undefined.
538 pub err: *mut crate::ln::msgs::DecodeError,
541 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
542 /// containing a crate::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::ln::msgs::DecodeError on failure.
543 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
544 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
545 /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
546 /// `err` or `result` depending on the state of `result_ok`.
547 pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
548 /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
552 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
553 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
554 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
555 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
556 result: Box::into_raw(Box::new(o)),
562 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
563 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
564 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
565 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
566 err: Box::into_raw(Box::new(e)),
572 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
573 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
574 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
577 if unsafe { !(self.contents.result as *mut ()).is_null() } {
578 let _ = unsafe { Box::from_raw(self.contents.result) };
581 if unsafe { !(self.contents.err as *mut ()).is_null() } {
582 let _ = unsafe { Box::from_raw(self.contents.err) };
587 impl From<crate::c_types::CResultTempl<crate::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
588 fn from(mut o: crate::c_types::CResultTempl<crate::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::ln::msgs::DecodeError>) -> Self {
589 let contents = if o.result_ok {
590 let result = unsafe { o.contents.result };
591 unsafe { o.contents.result = std::ptr::null_mut() };
592 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
594 let err = unsafe { o.contents.err };
595 unsafe { o.contents.err = std::ptr::null_mut(); }
596 CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
600 result_ok: o.result_ok,
604 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
605 fn clone(&self) -> Self {
607 Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
608 result: Box::into_raw(Box::new(<crate::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
611 Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
612 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
618 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
619 /// but with all dynamically-allocated buffers duplicated in new buffers.
620 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { orig.clone() }
622 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
623 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
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::ln::chan_utils::ChannelTransactionParameters,
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::ln::msgs::DecodeError,
632 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
633 /// containing a crate::ln::chan_utils::ChannelTransactionParameters on success and a crate::ln::msgs::DecodeError on failure.
634 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
635 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
636 /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
637 /// `err` or `result` depending on the state of `result_ok`.
638 pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
639 /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
643 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
644 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
645 CResult_ChannelTransactionParametersDecodeErrorZ {
646 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
647 result: Box::into_raw(Box::new(o)),
653 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
654 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
655 CResult_ChannelTransactionParametersDecodeErrorZ {
656 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
657 err: Box::into_raw(Box::new(e)),
663 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
664 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
665 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
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::ln::chan_utils::ChannelTransactionParameters, crate::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
679 fn from(mut o: crate::c_types::CResultTempl<crate::ln::chan_utils::ChannelTransactionParameters, crate::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_ChannelTransactionParametersDecodeErrorZPtr { result }
685 let err = unsafe { o.contents.err };
686 unsafe { o.contents.err = std::ptr::null_mut(); }
687 CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
691 result_ok: o.result_ok,
695 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
696 fn clone(&self) -> Self {
698 Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
699 result: Box::into_raw(Box::new(<crate::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
702 Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
703 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
709 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
710 /// but with all dynamically-allocated buffers duplicated in new buffers.
711 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { orig.clone() }
713 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
714 /// This corresponds to std::vector in C++
715 pub struct CVec_SignatureZ {
716 /// The elements in the array.
717 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
718 pub data: *mut crate::c_types::Signature,
719 /// The number of elements pointed to by `data`.
722 impl CVec_SignatureZ {
723 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
724 if self.datalen == 0 { return Vec::new(); }
725 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
726 self.data = std::ptr::null_mut();
730 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
731 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
734 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
735 fn from(v: Vec<crate::c_types::Signature>) -> Self {
736 let datalen = v.len();
737 let data = Box::into_raw(v.into_boxed_slice());
738 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
742 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
743 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
744 impl Drop for CVec_SignatureZ {
746 if self.datalen == 0 { return; }
747 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
750 impl Clone for CVec_SignatureZ {
751 fn clone(&self) -> Self {
752 let mut res = Vec::new();
753 if self.datalen == 0 { return Self::from(res); }
754 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
759 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
760 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
761 /// A pointer to the contents in the success state.
762 /// Reading from this pointer when `result_ok` is not set is undefined.
763 pub result: *mut crate::ln::chan_utils::HolderCommitmentTransaction,
764 /// A pointer to the contents in the error state.
765 /// Reading from this pointer when `result_ok` is set is undefined.
766 pub err: *mut crate::ln::msgs::DecodeError,
769 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
770 /// containing a crate::ln::chan_utils::HolderCommitmentTransaction on success and a crate::ln::msgs::DecodeError on failure.
771 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
772 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
773 /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
774 /// `err` or `result` depending on the state of `result_ok`.
775 pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
776 /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
780 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
781 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
782 CResult_HolderCommitmentTransactionDecodeErrorZ {
783 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
784 result: Box::into_raw(Box::new(o)),
790 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
791 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
792 CResult_HolderCommitmentTransactionDecodeErrorZ {
793 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
794 err: Box::into_raw(Box::new(e)),
800 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
801 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
802 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
805 if unsafe { !(self.contents.result as *mut ()).is_null() } {
806 let _ = unsafe { Box::from_raw(self.contents.result) };
809 if unsafe { !(self.contents.err as *mut ()).is_null() } {
810 let _ = unsafe { Box::from_raw(self.contents.err) };
815 impl From<crate::c_types::CResultTempl<crate::ln::chan_utils::HolderCommitmentTransaction, crate::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
816 fn from(mut o: crate::c_types::CResultTempl<crate::ln::chan_utils::HolderCommitmentTransaction, crate::ln::msgs::DecodeError>) -> Self {
817 let contents = if o.result_ok {
818 let result = unsafe { o.contents.result };
819 unsafe { o.contents.result = std::ptr::null_mut() };
820 CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
822 let err = unsafe { o.contents.err };
823 unsafe { o.contents.err = std::ptr::null_mut(); }
824 CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
828 result_ok: o.result_ok,
832 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
833 fn clone(&self) -> Self {
835 Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
836 result: Box::into_raw(Box::new(<crate::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
839 Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
840 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
846 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
847 /// but with all dynamically-allocated buffers duplicated in new buffers.
848 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { orig.clone() }
850 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
851 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
852 /// A pointer to the contents in the success state.
853 /// Reading from this pointer when `result_ok` is not set is undefined.
854 pub result: *mut crate::ln::chan_utils::BuiltCommitmentTransaction,
855 /// A pointer to the contents in the error state.
856 /// Reading from this pointer when `result_ok` is set is undefined.
857 pub err: *mut crate::ln::msgs::DecodeError,
860 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
861 /// containing a crate::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::ln::msgs::DecodeError on failure.
862 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
863 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
864 /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
865 /// `err` or `result` depending on the state of `result_ok`.
866 pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
867 /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
871 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
872 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
873 CResult_BuiltCommitmentTransactionDecodeErrorZ {
874 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
875 result: Box::into_raw(Box::new(o)),
881 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
882 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
883 CResult_BuiltCommitmentTransactionDecodeErrorZ {
884 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
885 err: Box::into_raw(Box::new(e)),
891 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
892 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
893 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
896 if unsafe { !(self.contents.result as *mut ()).is_null() } {
897 let _ = unsafe { Box::from_raw(self.contents.result) };
900 if unsafe { !(self.contents.err as *mut ()).is_null() } {
901 let _ = unsafe { Box::from_raw(self.contents.err) };
906 impl From<crate::c_types::CResultTempl<crate::ln::chan_utils::BuiltCommitmentTransaction, crate::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
907 fn from(mut o: crate::c_types::CResultTempl<crate::ln::chan_utils::BuiltCommitmentTransaction, crate::ln::msgs::DecodeError>) -> Self {
908 let contents = if o.result_ok {
909 let result = unsafe { o.contents.result };
910 unsafe { o.contents.result = std::ptr::null_mut() };
911 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
913 let err = unsafe { o.contents.err };
914 unsafe { o.contents.err = std::ptr::null_mut(); }
915 CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
919 result_ok: o.result_ok,
923 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
924 fn clone(&self) -> Self {
926 Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
927 result: Box::into_raw(Box::new(<crate::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
930 Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
931 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
937 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
938 /// but with all dynamically-allocated buffers duplicated in new buffers.
939 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { orig.clone() }
941 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
942 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
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::ln::chan_utils::CommitmentTransaction,
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::ln::msgs::DecodeError,
951 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
952 /// containing a crate::ln::chan_utils::CommitmentTransaction on success and a crate::ln::msgs::DecodeError on failure.
953 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
954 pub struct CResult_CommitmentTransactionDecodeErrorZ {
955 /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
956 /// `err` or `result` depending on the state of `result_ok`.
957 pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
958 /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
962 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
963 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
964 CResult_CommitmentTransactionDecodeErrorZ {
965 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
966 result: Box::into_raw(Box::new(o)),
972 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
973 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
974 CResult_CommitmentTransactionDecodeErrorZ {
975 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
976 err: Box::into_raw(Box::new(e)),
982 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
983 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
984 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
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::ln::chan_utils::CommitmentTransaction, crate::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
998 fn from(mut o: crate::c_types::CResultTempl<crate::ln::chan_utils::CommitmentTransaction, crate::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_CommitmentTransactionDecodeErrorZPtr { result }
1004 let err = unsafe { o.contents.err };
1005 unsafe { o.contents.err = std::ptr::null_mut(); }
1006 CResult_CommitmentTransactionDecodeErrorZPtr { err }
1010 result_ok: o.result_ok,
1014 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
1015 fn clone(&self) -> Self {
1017 Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1018 result: Box::into_raw(Box::new(<crate::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1021 Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1022 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1028 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
1029 /// but with all dynamically-allocated buffers duplicated in new buffers.
1030 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { orig.clone() }
1032 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
1033 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
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::ln::chan_utils::TrustedCommitmentTransaction,
1037 /// Note that this value is always NULL, as there are no contents in the Err variant
1038 pub err: *mut std::ffi::c_void,
1041 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1042 /// containing a crate::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1043 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1044 pub struct CResult_TrustedCommitmentTransactionNoneZ {
1045 /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1046 /// `err` or `result` depending on the state of `result_ok`.
1047 pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
1048 /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1049 pub result_ok: bool,
1052 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
1053 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
1054 CResult_TrustedCommitmentTransactionNoneZ {
1055 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1056 result: Box::into_raw(Box::new(o)),
1062 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
1063 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
1064 CResult_TrustedCommitmentTransactionNoneZ {
1065 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1066 err: std::ptr::null_mut(),
1072 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
1073 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
1074 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
1075 fn drop(&mut self) {
1077 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1078 let _ = unsafe { Box::from_raw(self.contents.result) };
1084 impl From<crate::c_types::CResultTempl<crate::ln::chan_utils::TrustedCommitmentTransaction, u8>> for CResult_TrustedCommitmentTransactionNoneZ {
1085 fn from(mut o: crate::c_types::CResultTempl<crate::ln::chan_utils::TrustedCommitmentTransaction, u8>) -> Self {
1086 let contents = if o.result_ok {
1087 let result = unsafe { o.contents.result };
1088 unsafe { o.contents.result = std::ptr::null_mut() };
1089 CResult_TrustedCommitmentTransactionNoneZPtr { result }
1091 let _ = unsafe { Box::from_raw(o.contents.err) };
1092 o.contents.err = std::ptr::null_mut();
1093 CResult_TrustedCommitmentTransactionNoneZPtr { err: std::ptr::null_mut() }
1097 result_ok: o.result_ok,
1102 /// The contents of CResult_CVec_SignatureZNoneZ
1103 pub union CResult_CVec_SignatureZNoneZPtr {
1104 /// A pointer to the contents in the success state.
1105 /// Reading from this pointer when `result_ok` is not set is undefined.
1106 pub result: *mut crate::c_types::derived::CVec_SignatureZ,
1107 /// Note that this value is always NULL, as there are no contents in the Err variant
1108 pub err: *mut std::ffi::c_void,
1111 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1112 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1113 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1114 pub struct CResult_CVec_SignatureZNoneZ {
1115 /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1116 /// `err` or `result` depending on the state of `result_ok`.
1117 pub contents: CResult_CVec_SignatureZNoneZPtr,
1118 /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1119 pub result_ok: bool,
1122 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
1123 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
1124 CResult_CVec_SignatureZNoneZ {
1125 contents: CResult_CVec_SignatureZNoneZPtr {
1126 result: Box::into_raw(Box::new(o)),
1132 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
1133 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
1134 CResult_CVec_SignatureZNoneZ {
1135 contents: CResult_CVec_SignatureZNoneZPtr {
1136 err: std::ptr::null_mut(),
1142 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
1143 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
1144 impl Drop for CResult_CVec_SignatureZNoneZ {
1145 fn drop(&mut self) {
1147 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1148 let _ = unsafe { Box::from_raw(self.contents.result) };
1154 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, u8>> for CResult_CVec_SignatureZNoneZ {
1155 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, u8>) -> Self {
1156 let contents = if o.result_ok {
1157 let result = unsafe { o.contents.result };
1158 unsafe { o.contents.result = std::ptr::null_mut() };
1159 CResult_CVec_SignatureZNoneZPtr { result }
1161 let _ = unsafe { Box::from_raw(o.contents.err) };
1162 o.contents.err = std::ptr::null_mut();
1163 CResult_CVec_SignatureZNoneZPtr { err: std::ptr::null_mut() }
1167 result_ok: o.result_ok,
1171 impl Clone for CResult_CVec_SignatureZNoneZ {
1172 fn clone(&self) -> Self {
1174 Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
1175 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
1178 Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
1179 err: std::ptr::null_mut()
1185 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
1186 /// but with all dynamically-allocated buffers duplicated in new buffers.
1187 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { orig.clone() }
1189 /// A dynamically-allocated array of crate::util::events::MessageSendEvents of arbitrary size.
1190 /// This corresponds to std::vector in C++
1191 pub struct CVec_MessageSendEventZ {
1192 /// The elements in the array.
1193 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1194 pub data: *mut crate::util::events::MessageSendEvent,
1195 /// The number of elements pointed to by `data`.
1198 impl CVec_MessageSendEventZ {
1199 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::util::events::MessageSendEvent> {
1200 if self.datalen == 0 { return Vec::new(); }
1201 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1202 self.data = std::ptr::null_mut();
1206 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::util::events::MessageSendEvent] {
1207 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1210 impl From<Vec<crate::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
1211 fn from(v: Vec<crate::util::events::MessageSendEvent>) -> Self {
1212 let datalen = v.len();
1213 let data = Box::into_raw(v.into_boxed_slice());
1214 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1218 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1219 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
1220 impl Drop for CVec_MessageSendEventZ {
1221 fn drop(&mut self) {
1222 if self.datalen == 0 { return; }
1223 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1226 impl Clone for CVec_MessageSendEventZ {
1227 fn clone(&self) -> Self {
1228 let mut res = Vec::new();
1229 if self.datalen == 0 { return Self::from(res); }
1230 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1235 /// The contents of CResult_boolLightningErrorZ
1236 pub union CResult_boolLightningErrorZPtr {
1237 /// A pointer to the contents in the success state.
1238 /// Reading from this pointer when `result_ok` is not set is undefined.
1239 pub result: *mut bool,
1240 /// A pointer to the contents in the error state.
1241 /// Reading from this pointer when `result_ok` is set is undefined.
1242 pub err: *mut crate::ln::msgs::LightningError,
1245 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
1246 /// containing a bool on success and a crate::ln::msgs::LightningError on failure.
1247 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1248 pub struct CResult_boolLightningErrorZ {
1249 /// The contents of this CResult_boolLightningErrorZ, accessible via either
1250 /// `err` or `result` depending on the state of `result_ok`.
1251 pub contents: CResult_boolLightningErrorZPtr,
1252 /// Whether this CResult_boolLightningErrorZ represents a success state.
1253 pub result_ok: bool,
1256 /// Creates a new CResult_boolLightningErrorZ in the success state.
1257 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
1258 CResult_boolLightningErrorZ {
1259 contents: CResult_boolLightningErrorZPtr {
1260 result: Box::into_raw(Box::new(o)),
1266 /// Creates a new CResult_boolLightningErrorZ in the error state.
1267 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
1268 CResult_boolLightningErrorZ {
1269 contents: CResult_boolLightningErrorZPtr {
1270 err: Box::into_raw(Box::new(e)),
1276 /// Frees any resources used by the CResult_boolLightningErrorZ.
1277 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
1278 impl Drop for CResult_boolLightningErrorZ {
1279 fn drop(&mut self) {
1281 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1282 let _ = unsafe { Box::from_raw(self.contents.result) };
1285 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1286 let _ = unsafe { Box::from_raw(self.contents.err) };
1291 impl From<crate::c_types::CResultTempl<bool, crate::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
1292 fn from(mut o: crate::c_types::CResultTempl<bool, crate::ln::msgs::LightningError>) -> Self {
1293 let contents = if o.result_ok {
1294 let result = unsafe { o.contents.result };
1295 unsafe { o.contents.result = std::ptr::null_mut() };
1296 CResult_boolLightningErrorZPtr { result }
1298 let err = unsafe { o.contents.err };
1299 unsafe { o.contents.err = std::ptr::null_mut(); }
1300 CResult_boolLightningErrorZPtr { err }
1304 result_ok: o.result_ok,
1308 impl Clone for CResult_boolLightningErrorZ {
1309 fn clone(&self) -> Self {
1311 Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
1312 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
1315 Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
1316 err: Box::into_raw(Box::new(<crate::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
1322 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
1323 /// but with all dynamically-allocated buffers duplicated in new buffers.
1324 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { orig.clone() }
1326 /// A tuple of 3 elements. See the individual fields for the types contained.
1327 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
1328 /// The element at position 0
1329 pub a: crate::ln::msgs::ChannelAnnouncement,
1330 /// The element at position 1
1331 pub b: crate::ln::msgs::ChannelUpdate,
1332 /// The element at position 2
1333 pub c: crate::ln::msgs::ChannelUpdate,
1335 impl From<(crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::ChannelUpdate, crate::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
1336 fn from (tup: (crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::ChannelUpdate, crate::ln::msgs::ChannelUpdate)) -> Self {
1344 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
1345 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::ChannelUpdate, crate::ln::msgs::ChannelUpdate) {
1346 (self.a, self.b, self.c)
1349 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
1350 fn clone(&self) -> Self {
1359 /// Creates a new tuple which has the same data as `orig`
1360 /// but with all dynamically-allocated buffers duplicated in new buffers.
1361 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { orig.clone() }
1362 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
1364 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a: crate::ln::msgs::ChannelAnnouncement, b: crate::ln::msgs::ChannelUpdate, c: crate::ln::msgs::ChannelUpdate) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
1365 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
1369 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
1370 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
1372 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
1373 /// This corresponds to std::vector in C++
1374 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
1375 /// The elements in the array.
1376 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1377 pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
1378 /// The number of elements pointed to by `data`.
1381 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
1382 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
1383 if self.datalen == 0 { return Vec::new(); }
1384 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1385 self.data = std::ptr::null_mut();
1389 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
1390 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1393 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
1394 fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
1395 let datalen = v.len();
1396 let data = Box::into_raw(v.into_boxed_slice());
1397 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1401 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1402 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
1403 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
1404 fn drop(&mut self) {
1405 if self.datalen == 0 { return; }
1406 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1409 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
1410 fn clone(&self) -> Self {
1411 let mut res = Vec::new();
1412 if self.datalen == 0 { return Self::from(res); }
1413 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1418 /// A dynamically-allocated array of crate::ln::msgs::NodeAnnouncements of arbitrary size.
1419 /// This corresponds to std::vector in C++
1420 pub struct CVec_NodeAnnouncementZ {
1421 /// The elements in the array.
1422 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1423 pub data: *mut crate::ln::msgs::NodeAnnouncement,
1424 /// The number of elements pointed to by `data`.
1427 impl CVec_NodeAnnouncementZ {
1428 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::NodeAnnouncement> {
1429 if self.datalen == 0 { return Vec::new(); }
1430 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1431 self.data = std::ptr::null_mut();
1435 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::NodeAnnouncement] {
1436 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1439 impl From<Vec<crate::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
1440 fn from(v: Vec<crate::ln::msgs::NodeAnnouncement>) -> Self {
1441 let datalen = v.len();
1442 let data = Box::into_raw(v.into_boxed_slice());
1443 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1447 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1448 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
1449 impl Drop for CVec_NodeAnnouncementZ {
1450 fn drop(&mut self) {
1451 if self.datalen == 0 { return; }
1452 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1455 impl Clone for CVec_NodeAnnouncementZ {
1456 fn clone(&self) -> Self {
1457 let mut res = Vec::new();
1458 if self.datalen == 0 { return Self::from(res); }
1459 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1464 /// The contents of CResult_NoneLightningErrorZ
1465 pub union CResult_NoneLightningErrorZPtr {
1466 /// Note that this value is always NULL, as there are no contents in the OK variant
1467 pub result: *mut std::ffi::c_void,
1468 /// A pointer to the contents in the error state.
1469 /// Reading from this pointer when `result_ok` is set is undefined.
1470 pub err: *mut crate::ln::msgs::LightningError,
1473 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
1474 /// containing a () on success and a crate::ln::msgs::LightningError on failure.
1475 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1476 pub struct CResult_NoneLightningErrorZ {
1477 /// The contents of this CResult_NoneLightningErrorZ, accessible via either
1478 /// `err` or `result` depending on the state of `result_ok`.
1479 pub contents: CResult_NoneLightningErrorZPtr,
1480 /// Whether this CResult_NoneLightningErrorZ represents a success state.
1481 pub result_ok: bool,
1484 /// Creates a new CResult_NoneLightningErrorZ in the success state.
1485 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
1486 CResult_NoneLightningErrorZ {
1487 contents: CResult_NoneLightningErrorZPtr {
1488 result: std::ptr::null_mut(),
1494 /// Creates a new CResult_NoneLightningErrorZ in the error state.
1495 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
1496 CResult_NoneLightningErrorZ {
1497 contents: CResult_NoneLightningErrorZPtr {
1498 err: Box::into_raw(Box::new(e)),
1504 /// Frees any resources used by the CResult_NoneLightningErrorZ.
1505 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
1506 impl Drop for CResult_NoneLightningErrorZ {
1507 fn drop(&mut self) {
1510 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1511 let _ = unsafe { Box::from_raw(self.contents.err) };
1516 impl From<crate::c_types::CResultTempl<u8, crate::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
1517 fn from(mut o: crate::c_types::CResultTempl<u8, crate::ln::msgs::LightningError>) -> Self {
1518 let contents = if o.result_ok {
1519 let _ = unsafe { Box::from_raw(o.contents.result) };
1520 o.contents.result = std::ptr::null_mut();
1521 CResult_NoneLightningErrorZPtr { result: std::ptr::null_mut() }
1523 let err = unsafe { o.contents.err };
1524 unsafe { o.contents.err = std::ptr::null_mut(); }
1525 CResult_NoneLightningErrorZPtr { err }
1529 result_ok: o.result_ok,
1533 impl Clone for CResult_NoneLightningErrorZ {
1534 fn clone(&self) -> Self {
1536 Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
1537 result: std::ptr::null_mut()
1540 Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
1541 err: Box::into_raw(Box::new(<crate::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
1547 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
1548 /// but with all dynamically-allocated buffers duplicated in new buffers.
1549 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { orig.clone() }
1551 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
1552 /// This corresponds to std::vector in C++
1553 pub struct CVec_PublicKeyZ {
1554 /// The elements in the array.
1555 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1556 pub data: *mut crate::c_types::PublicKey,
1557 /// The number of elements pointed to by `data`.
1560 impl CVec_PublicKeyZ {
1561 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
1562 if self.datalen == 0 { return Vec::new(); }
1563 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1564 self.data = std::ptr::null_mut();
1568 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
1569 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1572 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
1573 fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
1574 let datalen = v.len();
1575 let data = Box::into_raw(v.into_boxed_slice());
1576 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1580 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1581 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
1582 impl Drop for CVec_PublicKeyZ {
1583 fn drop(&mut self) {
1584 if self.datalen == 0 { return; }
1585 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1589 /// A dynamically-allocated array of u8s of arbitrary size.
1590 /// This corresponds to std::vector in C++
1591 pub struct CVec_u8Z {
1592 /// The elements in the array.
1593 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1595 /// The number of elements pointed to by `data`.
1599 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
1600 if self.datalen == 0 { return Vec::new(); }
1601 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1602 self.data = std::ptr::null_mut();
1606 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
1607 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1610 impl From<Vec<u8>> for CVec_u8Z {
1611 fn from(v: Vec<u8>) -> Self {
1612 let datalen = v.len();
1613 let data = Box::into_raw(v.into_boxed_slice());
1614 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1618 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1619 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
1620 impl Drop for CVec_u8Z {
1621 fn drop(&mut self) {
1622 if self.datalen == 0 { return; }
1623 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1626 impl Clone for CVec_u8Z {
1627 fn clone(&self) -> Self {
1628 let mut res = Vec::new();
1629 if self.datalen == 0 { return Self::from(res); }
1630 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1635 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
1636 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
1637 /// A pointer to the contents in the success state.
1638 /// Reading from this pointer when `result_ok` is not set is undefined.
1639 pub result: *mut crate::c_types::derived::CVec_u8Z,
1640 /// A pointer to the contents in the error state.
1641 /// Reading from this pointer when `result_ok` is set is undefined.
1642 pub err: *mut crate::ln::peer_handler::PeerHandleError,
1645 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
1646 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::ln::peer_handler::PeerHandleError on failure.
1647 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1648 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
1649 /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
1650 /// `err` or `result` depending on the state of `result_ok`.
1651 pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
1652 /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
1653 pub result_ok: bool,
1656 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
1657 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
1658 CResult_CVec_u8ZPeerHandleErrorZ {
1659 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
1660 result: Box::into_raw(Box::new(o)),
1666 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
1667 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
1668 CResult_CVec_u8ZPeerHandleErrorZ {
1669 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
1670 err: Box::into_raw(Box::new(e)),
1676 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
1677 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
1678 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
1679 fn drop(&mut self) {
1681 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1682 let _ = unsafe { Box::from_raw(self.contents.result) };
1685 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1686 let _ = unsafe { Box::from_raw(self.contents.err) };
1691 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
1692 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::ln::peer_handler::PeerHandleError>) -> Self {
1693 let contents = if o.result_ok {
1694 let result = unsafe { o.contents.result };
1695 unsafe { o.contents.result = std::ptr::null_mut() };
1696 CResult_CVec_u8ZPeerHandleErrorZPtr { result }
1698 let err = unsafe { o.contents.err };
1699 unsafe { o.contents.err = std::ptr::null_mut(); }
1700 CResult_CVec_u8ZPeerHandleErrorZPtr { err }
1704 result_ok: o.result_ok,
1708 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
1709 fn clone(&self) -> Self {
1711 Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
1712 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
1715 Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
1716 err: Box::into_raw(Box::new(<crate::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
1722 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
1723 /// but with all dynamically-allocated buffers duplicated in new buffers.
1724 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { orig.clone() }
1726 /// The contents of CResult_NonePeerHandleErrorZ
1727 pub union CResult_NonePeerHandleErrorZPtr {
1728 /// Note that this value is always NULL, as there are no contents in the OK variant
1729 pub result: *mut std::ffi::c_void,
1730 /// A pointer to the contents in the error state.
1731 /// Reading from this pointer when `result_ok` is set is undefined.
1732 pub err: *mut crate::ln::peer_handler::PeerHandleError,
1735 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
1736 /// containing a () on success and a crate::ln::peer_handler::PeerHandleError on failure.
1737 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1738 pub struct CResult_NonePeerHandleErrorZ {
1739 /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
1740 /// `err` or `result` depending on the state of `result_ok`.
1741 pub contents: CResult_NonePeerHandleErrorZPtr,
1742 /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
1743 pub result_ok: bool,
1746 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
1747 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
1748 CResult_NonePeerHandleErrorZ {
1749 contents: CResult_NonePeerHandleErrorZPtr {
1750 result: std::ptr::null_mut(),
1756 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
1757 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
1758 CResult_NonePeerHandleErrorZ {
1759 contents: CResult_NonePeerHandleErrorZPtr {
1760 err: Box::into_raw(Box::new(e)),
1766 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
1767 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
1768 impl Drop for CResult_NonePeerHandleErrorZ {
1769 fn drop(&mut self) {
1772 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1773 let _ = unsafe { Box::from_raw(self.contents.err) };
1778 impl From<crate::c_types::CResultTempl<u8, crate::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
1779 fn from(mut o: crate::c_types::CResultTempl<u8, crate::ln::peer_handler::PeerHandleError>) -> Self {
1780 let contents = if o.result_ok {
1781 let _ = unsafe { Box::from_raw(o.contents.result) };
1782 o.contents.result = std::ptr::null_mut();
1783 CResult_NonePeerHandleErrorZPtr { result: std::ptr::null_mut() }
1785 let err = unsafe { o.contents.err };
1786 unsafe { o.contents.err = std::ptr::null_mut(); }
1787 CResult_NonePeerHandleErrorZPtr { err }
1791 result_ok: o.result_ok,
1795 impl Clone for CResult_NonePeerHandleErrorZ {
1796 fn clone(&self) -> Self {
1798 Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
1799 result: std::ptr::null_mut()
1802 Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
1803 err: Box::into_raw(Box::new(<crate::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
1809 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
1810 /// but with all dynamically-allocated buffers duplicated in new buffers.
1811 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { orig.clone() }
1813 /// The contents of CResult_boolPeerHandleErrorZ
1814 pub union CResult_boolPeerHandleErrorZPtr {
1815 /// A pointer to the contents in the success state.
1816 /// Reading from this pointer when `result_ok` is not set is undefined.
1817 pub result: *mut bool,
1818 /// A pointer to the contents in the error state.
1819 /// Reading from this pointer when `result_ok` is set is undefined.
1820 pub err: *mut crate::ln::peer_handler::PeerHandleError,
1823 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
1824 /// containing a bool on success and a crate::ln::peer_handler::PeerHandleError on failure.
1825 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1826 pub struct CResult_boolPeerHandleErrorZ {
1827 /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
1828 /// `err` or `result` depending on the state of `result_ok`.
1829 pub contents: CResult_boolPeerHandleErrorZPtr,
1830 /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
1831 pub result_ok: bool,
1834 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
1835 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
1836 CResult_boolPeerHandleErrorZ {
1837 contents: CResult_boolPeerHandleErrorZPtr {
1838 result: Box::into_raw(Box::new(o)),
1844 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
1845 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
1846 CResult_boolPeerHandleErrorZ {
1847 contents: CResult_boolPeerHandleErrorZPtr {
1848 err: Box::into_raw(Box::new(e)),
1854 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
1855 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
1856 impl Drop for CResult_boolPeerHandleErrorZ {
1857 fn drop(&mut self) {
1859 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1860 let _ = unsafe { Box::from_raw(self.contents.result) };
1863 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1864 let _ = unsafe { Box::from_raw(self.contents.err) };
1869 impl From<crate::c_types::CResultTempl<bool, crate::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
1870 fn from(mut o: crate::c_types::CResultTempl<bool, crate::ln::peer_handler::PeerHandleError>) -> Self {
1871 let contents = if o.result_ok {
1872 let result = unsafe { o.contents.result };
1873 unsafe { o.contents.result = std::ptr::null_mut() };
1874 CResult_boolPeerHandleErrorZPtr { result }
1876 let err = unsafe { o.contents.err };
1877 unsafe { o.contents.err = std::ptr::null_mut(); }
1878 CResult_boolPeerHandleErrorZPtr { err }
1882 result_ok: o.result_ok,
1886 impl Clone for CResult_boolPeerHandleErrorZ {
1887 fn clone(&self) -> Self {
1889 Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
1890 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
1893 Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
1894 err: Box::into_raw(Box::new(<crate::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
1900 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
1901 /// but with all dynamically-allocated buffers duplicated in new buffers.
1902 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { orig.clone() }
1904 /// The contents of CResult_InitFeaturesDecodeErrorZ
1905 pub union CResult_InitFeaturesDecodeErrorZPtr {
1906 /// A pointer to the contents in the success state.
1907 /// Reading from this pointer when `result_ok` is not set is undefined.
1908 pub result: *mut crate::ln::features::InitFeatures,
1909 /// A pointer to the contents in the error state.
1910 /// Reading from this pointer when `result_ok` is set is undefined.
1911 pub err: *mut crate::ln::msgs::DecodeError,
1914 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
1915 /// containing a crate::ln::features::InitFeatures on success and a crate::ln::msgs::DecodeError on failure.
1916 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1917 pub struct CResult_InitFeaturesDecodeErrorZ {
1918 /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
1919 /// `err` or `result` depending on the state of `result_ok`.
1920 pub contents: CResult_InitFeaturesDecodeErrorZPtr,
1921 /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
1922 pub result_ok: bool,
1925 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
1926 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
1927 CResult_InitFeaturesDecodeErrorZ {
1928 contents: CResult_InitFeaturesDecodeErrorZPtr {
1929 result: Box::into_raw(Box::new(o)),
1935 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
1936 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
1937 CResult_InitFeaturesDecodeErrorZ {
1938 contents: CResult_InitFeaturesDecodeErrorZPtr {
1939 err: Box::into_raw(Box::new(e)),
1945 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
1946 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
1947 impl Drop for CResult_InitFeaturesDecodeErrorZ {
1948 fn drop(&mut self) {
1950 if unsafe { !(self.contents.result as *mut ()).is_null() } {
1951 let _ = unsafe { Box::from_raw(self.contents.result) };
1954 if unsafe { !(self.contents.err as *mut ()).is_null() } {
1955 let _ = unsafe { Box::from_raw(self.contents.err) };
1960 impl From<crate::c_types::CResultTempl<crate::ln::features::InitFeatures, crate::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
1961 fn from(mut o: crate::c_types::CResultTempl<crate::ln::features::InitFeatures, crate::ln::msgs::DecodeError>) -> Self {
1962 let contents = if o.result_ok {
1963 let result = unsafe { o.contents.result };
1964 unsafe { o.contents.result = std::ptr::null_mut() };
1965 CResult_InitFeaturesDecodeErrorZPtr { result }
1967 let err = unsafe { o.contents.err };
1968 unsafe { o.contents.err = std::ptr::null_mut(); }
1969 CResult_InitFeaturesDecodeErrorZPtr { err }
1973 result_ok: o.result_ok,
1978 /// The contents of CResult_NodeFeaturesDecodeErrorZ
1979 pub union CResult_NodeFeaturesDecodeErrorZPtr {
1980 /// A pointer to the contents in the success state.
1981 /// Reading from this pointer when `result_ok` is not set is undefined.
1982 pub result: *mut crate::ln::features::NodeFeatures,
1983 /// A pointer to the contents in the error state.
1984 /// Reading from this pointer when `result_ok` is set is undefined.
1985 pub err: *mut crate::ln::msgs::DecodeError,
1988 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
1989 /// containing a crate::ln::features::NodeFeatures on success and a crate::ln::msgs::DecodeError on failure.
1990 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1991 pub struct CResult_NodeFeaturesDecodeErrorZ {
1992 /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
1993 /// `err` or `result` depending on the state of `result_ok`.
1994 pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
1995 /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
1996 pub result_ok: bool,
1999 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
2000 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
2001 CResult_NodeFeaturesDecodeErrorZ {
2002 contents: CResult_NodeFeaturesDecodeErrorZPtr {
2003 result: Box::into_raw(Box::new(o)),
2009 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
2010 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
2011 CResult_NodeFeaturesDecodeErrorZ {
2012 contents: CResult_NodeFeaturesDecodeErrorZPtr {
2013 err: Box::into_raw(Box::new(e)),
2019 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
2020 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
2021 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
2022 fn drop(&mut self) {
2024 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2025 let _ = unsafe { Box::from_raw(self.contents.result) };
2028 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2029 let _ = unsafe { Box::from_raw(self.contents.err) };
2034 impl From<crate::c_types::CResultTempl<crate::ln::features::NodeFeatures, crate::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
2035 fn from(mut o: crate::c_types::CResultTempl<crate::ln::features::NodeFeatures, crate::ln::msgs::DecodeError>) -> Self {
2036 let contents = if o.result_ok {
2037 let result = unsafe { o.contents.result };
2038 unsafe { o.contents.result = std::ptr::null_mut() };
2039 CResult_NodeFeaturesDecodeErrorZPtr { result }
2041 let err = unsafe { o.contents.err };
2042 unsafe { o.contents.err = std::ptr::null_mut(); }
2043 CResult_NodeFeaturesDecodeErrorZPtr { err }
2047 result_ok: o.result_ok,
2052 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
2053 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
2054 /// A pointer to the contents in the success state.
2055 /// Reading from this pointer when `result_ok` is not set is undefined.
2056 pub result: *mut crate::ln::features::ChannelFeatures,
2057 /// A pointer to the contents in the error state.
2058 /// Reading from this pointer when `result_ok` is set is undefined.
2059 pub err: *mut crate::ln::msgs::DecodeError,
2062 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
2063 /// containing a crate::ln::features::ChannelFeatures on success and a crate::ln::msgs::DecodeError on failure.
2064 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2065 pub struct CResult_ChannelFeaturesDecodeErrorZ {
2066 /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
2067 /// `err` or `result` depending on the state of `result_ok`.
2068 pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
2069 /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
2070 pub result_ok: bool,
2073 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
2074 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
2075 CResult_ChannelFeaturesDecodeErrorZ {
2076 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
2077 result: Box::into_raw(Box::new(o)),
2083 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
2084 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
2085 CResult_ChannelFeaturesDecodeErrorZ {
2086 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
2087 err: Box::into_raw(Box::new(e)),
2093 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
2094 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
2095 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
2096 fn drop(&mut self) {
2098 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2099 let _ = unsafe { Box::from_raw(self.contents.result) };
2102 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2103 let _ = unsafe { Box::from_raw(self.contents.err) };
2108 impl From<crate::c_types::CResultTempl<crate::ln::features::ChannelFeatures, crate::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
2109 fn from(mut o: crate::c_types::CResultTempl<crate::ln::features::ChannelFeatures, crate::ln::msgs::DecodeError>) -> Self {
2110 let contents = if o.result_ok {
2111 let result = unsafe { o.contents.result };
2112 unsafe { o.contents.result = std::ptr::null_mut() };
2113 CResult_ChannelFeaturesDecodeErrorZPtr { result }
2115 let err = unsafe { o.contents.err };
2116 unsafe { o.contents.err = std::ptr::null_mut(); }
2117 CResult_ChannelFeaturesDecodeErrorZPtr { err }
2121 result_ok: o.result_ok,
2126 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
2127 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
2128 /// A pointer to the contents in the success state.
2129 /// Reading from this pointer when `result_ok` is not set is undefined.
2130 pub result: *mut crate::ln::features::InvoiceFeatures,
2131 /// A pointer to the contents in the error state.
2132 /// Reading from this pointer when `result_ok` is set is undefined.
2133 pub err: *mut crate::ln::msgs::DecodeError,
2136 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
2137 /// containing a crate::ln::features::InvoiceFeatures on success and a crate::ln::msgs::DecodeError on failure.
2138 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2139 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
2140 /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
2141 /// `err` or `result` depending on the state of `result_ok`.
2142 pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
2143 /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
2144 pub result_ok: bool,
2147 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
2148 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
2149 CResult_InvoiceFeaturesDecodeErrorZ {
2150 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
2151 result: Box::into_raw(Box::new(o)),
2157 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
2158 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
2159 CResult_InvoiceFeaturesDecodeErrorZ {
2160 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
2161 err: Box::into_raw(Box::new(e)),
2167 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
2168 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
2169 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
2170 fn drop(&mut self) {
2172 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2173 let _ = unsafe { Box::from_raw(self.contents.result) };
2176 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2177 let _ = unsafe { Box::from_raw(self.contents.err) };
2182 impl From<crate::c_types::CResultTempl<crate::ln::features::InvoiceFeatures, crate::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
2183 fn from(mut o: crate::c_types::CResultTempl<crate::ln::features::InvoiceFeatures, crate::ln::msgs::DecodeError>) -> Self {
2184 let contents = if o.result_ok {
2185 let result = unsafe { o.contents.result };
2186 unsafe { o.contents.result = std::ptr::null_mut() };
2187 CResult_InvoiceFeaturesDecodeErrorZPtr { result }
2189 let err = unsafe { o.contents.err };
2190 unsafe { o.contents.err = std::ptr::null_mut(); }
2191 CResult_InvoiceFeaturesDecodeErrorZPtr { err }
2195 result_ok: o.result_ok,
2200 /// The contents of CResult_ChannelConfigDecodeErrorZ
2201 pub union CResult_ChannelConfigDecodeErrorZPtr {
2202 /// A pointer to the contents in the success state.
2203 /// Reading from this pointer when `result_ok` is not set is undefined.
2204 pub result: *mut crate::util::config::ChannelConfig,
2205 /// A pointer to the contents in the error state.
2206 /// Reading from this pointer when `result_ok` is set is undefined.
2207 pub err: *mut crate::ln::msgs::DecodeError,
2210 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
2211 /// containing a crate::util::config::ChannelConfig on success and a crate::ln::msgs::DecodeError on failure.
2212 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2213 pub struct CResult_ChannelConfigDecodeErrorZ {
2214 /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
2215 /// `err` or `result` depending on the state of `result_ok`.
2216 pub contents: CResult_ChannelConfigDecodeErrorZPtr,
2217 /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
2218 pub result_ok: bool,
2221 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
2222 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
2223 CResult_ChannelConfigDecodeErrorZ {
2224 contents: CResult_ChannelConfigDecodeErrorZPtr {
2225 result: Box::into_raw(Box::new(o)),
2231 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
2232 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
2233 CResult_ChannelConfigDecodeErrorZ {
2234 contents: CResult_ChannelConfigDecodeErrorZPtr {
2235 err: Box::into_raw(Box::new(e)),
2241 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
2242 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
2243 impl Drop for CResult_ChannelConfigDecodeErrorZ {
2244 fn drop(&mut self) {
2246 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2247 let _ = unsafe { Box::from_raw(self.contents.result) };
2250 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2251 let _ = unsafe { Box::from_raw(self.contents.err) };
2256 impl From<crate::c_types::CResultTempl<crate::util::config::ChannelConfig, crate::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
2257 fn from(mut o: crate::c_types::CResultTempl<crate::util::config::ChannelConfig, crate::ln::msgs::DecodeError>) -> Self {
2258 let contents = if o.result_ok {
2259 let result = unsafe { o.contents.result };
2260 unsafe { o.contents.result = std::ptr::null_mut() };
2261 CResult_ChannelConfigDecodeErrorZPtr { result }
2263 let err = unsafe { o.contents.err };
2264 unsafe { o.contents.err = std::ptr::null_mut(); }
2265 CResult_ChannelConfigDecodeErrorZPtr { err }
2269 result_ok: o.result_ok,
2273 impl Clone for CResult_ChannelConfigDecodeErrorZ {
2274 fn clone(&self) -> Self {
2276 Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
2277 result: Box::into_raw(Box::new(<crate::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
2280 Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
2281 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2287 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
2288 /// but with all dynamically-allocated buffers duplicated in new buffers.
2289 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { orig.clone() }
2292 /// An enum which can either contain a u64 or not
2293 pub enum COption_u64Z {
2294 /// When we're in this state, this COption_u64Z contains a u64
2296 /// When we're in this state, this COption_u64Z contains nothing
2300 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2301 if let Self::Some(_) = self { true } else { false }
2303 #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
2304 if let Self::Some(v) = self { v } else { unreachable!() }
2308 /// Constructs a new COption_u64Z containing a u64
2309 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
2310 COption_u64Z::Some(o)
2313 /// Constructs a new COption_u64Z containing nothing
2314 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
2318 /// Frees any resources associated with the u64, if we are in the Some state
2319 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
2321 /// Creates a new COption_u64Z which has the same data as `orig`
2322 /// but with all dynamically-allocated buffers duplicated in new buffers.
2323 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { orig.clone() }
2325 /// The contents of CResult_DirectionalChannelInfoDecodeErrorZ
2326 pub union CResult_DirectionalChannelInfoDecodeErrorZPtr {
2327 /// A pointer to the contents in the success state.
2328 /// Reading from this pointer when `result_ok` is not set is undefined.
2329 pub result: *mut crate::routing::network_graph::DirectionalChannelInfo,
2330 /// A pointer to the contents in the error state.
2331 /// Reading from this pointer when `result_ok` is set is undefined.
2332 pub err: *mut crate::ln::msgs::DecodeError,
2335 /// A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
2336 /// containing a crate::routing::network_graph::DirectionalChannelInfo on success and a crate::ln::msgs::DecodeError on failure.
2337 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2338 pub struct CResult_DirectionalChannelInfoDecodeErrorZ {
2339 /// The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
2340 /// `err` or `result` depending on the state of `result_ok`.
2341 pub contents: CResult_DirectionalChannelInfoDecodeErrorZPtr,
2342 /// Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
2343 pub result_ok: bool,
2346 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
2347 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_ok(o: crate::routing::network_graph::DirectionalChannelInfo) -> CResult_DirectionalChannelInfoDecodeErrorZ {
2348 CResult_DirectionalChannelInfoDecodeErrorZ {
2349 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
2350 result: Box::into_raw(Box::new(o)),
2356 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
2357 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_DirectionalChannelInfoDecodeErrorZ {
2358 CResult_DirectionalChannelInfoDecodeErrorZ {
2359 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
2360 err: Box::into_raw(Box::new(e)),
2366 /// Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
2367 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_free(_res: CResult_DirectionalChannelInfoDecodeErrorZ) { }
2368 impl Drop for CResult_DirectionalChannelInfoDecodeErrorZ {
2369 fn drop(&mut self) {
2371 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2372 let _ = unsafe { Box::from_raw(self.contents.result) };
2375 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2376 let _ = unsafe { Box::from_raw(self.contents.err) };
2381 impl From<crate::c_types::CResultTempl<crate::routing::network_graph::DirectionalChannelInfo, crate::ln::msgs::DecodeError>> for CResult_DirectionalChannelInfoDecodeErrorZ {
2382 fn from(mut o: crate::c_types::CResultTempl<crate::routing::network_graph::DirectionalChannelInfo, crate::ln::msgs::DecodeError>) -> Self {
2383 let contents = if o.result_ok {
2384 let result = unsafe { o.contents.result };
2385 unsafe { o.contents.result = std::ptr::null_mut() };
2386 CResult_DirectionalChannelInfoDecodeErrorZPtr { result }
2388 let err = unsafe { o.contents.err };
2389 unsafe { o.contents.err = std::ptr::null_mut(); }
2390 CResult_DirectionalChannelInfoDecodeErrorZPtr { err }
2394 result_ok: o.result_ok,
2398 impl Clone for CResult_DirectionalChannelInfoDecodeErrorZ {
2399 fn clone(&self) -> Self {
2401 Self { result_ok: true, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
2402 result: Box::into_raw(Box::new(<crate::routing::network_graph::DirectionalChannelInfo>::clone(unsafe { &*self.contents.result })))
2405 Self { result_ok: false, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
2406 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2412 /// Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
2413 /// but with all dynamically-allocated buffers duplicated in new buffers.
2414 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig: &CResult_DirectionalChannelInfoDecodeErrorZ) -> CResult_DirectionalChannelInfoDecodeErrorZ { orig.clone() }
2416 /// The contents of CResult_ChannelInfoDecodeErrorZ
2417 pub union CResult_ChannelInfoDecodeErrorZPtr {
2418 /// A pointer to the contents in the success state.
2419 /// Reading from this pointer when `result_ok` is not set is undefined.
2420 pub result: *mut crate::routing::network_graph::ChannelInfo,
2421 /// A pointer to the contents in the error state.
2422 /// Reading from this pointer when `result_ok` is set is undefined.
2423 pub err: *mut crate::ln::msgs::DecodeError,
2426 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
2427 /// containing a crate::routing::network_graph::ChannelInfo on success and a crate::ln::msgs::DecodeError on failure.
2428 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2429 pub struct CResult_ChannelInfoDecodeErrorZ {
2430 /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
2431 /// `err` or `result` depending on the state of `result_ok`.
2432 pub contents: CResult_ChannelInfoDecodeErrorZPtr,
2433 /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
2434 pub result_ok: bool,
2437 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
2438 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
2439 CResult_ChannelInfoDecodeErrorZ {
2440 contents: CResult_ChannelInfoDecodeErrorZPtr {
2441 result: Box::into_raw(Box::new(o)),
2447 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
2448 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
2449 CResult_ChannelInfoDecodeErrorZ {
2450 contents: CResult_ChannelInfoDecodeErrorZPtr {
2451 err: Box::into_raw(Box::new(e)),
2457 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
2458 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
2459 impl Drop for CResult_ChannelInfoDecodeErrorZ {
2460 fn drop(&mut self) {
2462 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2463 let _ = unsafe { Box::from_raw(self.contents.result) };
2466 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2467 let _ = unsafe { Box::from_raw(self.contents.err) };
2472 impl From<crate::c_types::CResultTempl<crate::routing::network_graph::ChannelInfo, crate::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
2473 fn from(mut o: crate::c_types::CResultTempl<crate::routing::network_graph::ChannelInfo, crate::ln::msgs::DecodeError>) -> Self {
2474 let contents = if o.result_ok {
2475 let result = unsafe { o.contents.result };
2476 unsafe { o.contents.result = std::ptr::null_mut() };
2477 CResult_ChannelInfoDecodeErrorZPtr { result }
2479 let err = unsafe { o.contents.err };
2480 unsafe { o.contents.err = std::ptr::null_mut(); }
2481 CResult_ChannelInfoDecodeErrorZPtr { err }
2485 result_ok: o.result_ok,
2489 impl Clone for CResult_ChannelInfoDecodeErrorZ {
2490 fn clone(&self) -> Self {
2492 Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
2493 result: Box::into_raw(Box::new(<crate::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
2496 Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
2497 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2503 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
2504 /// but with all dynamically-allocated buffers duplicated in new buffers.
2505 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { orig.clone() }
2507 /// The contents of CResult_RoutingFeesDecodeErrorZ
2508 pub union CResult_RoutingFeesDecodeErrorZPtr {
2509 /// A pointer to the contents in the success state.
2510 /// Reading from this pointer when `result_ok` is not set is undefined.
2511 pub result: *mut crate::routing::network_graph::RoutingFees,
2512 /// A pointer to the contents in the error state.
2513 /// Reading from this pointer when `result_ok` is set is undefined.
2514 pub err: *mut crate::ln::msgs::DecodeError,
2517 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
2518 /// containing a crate::routing::network_graph::RoutingFees on success and a crate::ln::msgs::DecodeError on failure.
2519 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2520 pub struct CResult_RoutingFeesDecodeErrorZ {
2521 /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
2522 /// `err` or `result` depending on the state of `result_ok`.
2523 pub contents: CResult_RoutingFeesDecodeErrorZPtr,
2524 /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
2525 pub result_ok: bool,
2528 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
2529 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
2530 CResult_RoutingFeesDecodeErrorZ {
2531 contents: CResult_RoutingFeesDecodeErrorZPtr {
2532 result: Box::into_raw(Box::new(o)),
2538 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
2539 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
2540 CResult_RoutingFeesDecodeErrorZ {
2541 contents: CResult_RoutingFeesDecodeErrorZPtr {
2542 err: Box::into_raw(Box::new(e)),
2548 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
2549 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
2550 impl Drop for CResult_RoutingFeesDecodeErrorZ {
2551 fn drop(&mut self) {
2553 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2554 let _ = unsafe { Box::from_raw(self.contents.result) };
2557 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2558 let _ = unsafe { Box::from_raw(self.contents.err) };
2563 impl From<crate::c_types::CResultTempl<crate::routing::network_graph::RoutingFees, crate::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
2564 fn from(mut o: crate::c_types::CResultTempl<crate::routing::network_graph::RoutingFees, crate::ln::msgs::DecodeError>) -> Self {
2565 let contents = if o.result_ok {
2566 let result = unsafe { o.contents.result };
2567 unsafe { o.contents.result = std::ptr::null_mut() };
2568 CResult_RoutingFeesDecodeErrorZPtr { result }
2570 let err = unsafe { o.contents.err };
2571 unsafe { o.contents.err = std::ptr::null_mut(); }
2572 CResult_RoutingFeesDecodeErrorZPtr { err }
2576 result_ok: o.result_ok,
2580 impl Clone for CResult_RoutingFeesDecodeErrorZ {
2581 fn clone(&self) -> Self {
2583 Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
2584 result: Box::into_raw(Box::new(<crate::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
2587 Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
2588 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2594 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
2595 /// but with all dynamically-allocated buffers duplicated in new buffers.
2596 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { orig.clone() }
2598 /// A dynamically-allocated array of crate::ln::msgs::NetAddresss of arbitrary size.
2599 /// This corresponds to std::vector in C++
2600 pub struct CVec_NetAddressZ {
2601 /// The elements in the array.
2602 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2603 pub data: *mut crate::ln::msgs::NetAddress,
2604 /// The number of elements pointed to by `data`.
2607 impl CVec_NetAddressZ {
2608 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::NetAddress> {
2609 if self.datalen == 0 { return Vec::new(); }
2610 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2611 self.data = std::ptr::null_mut();
2615 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::NetAddress] {
2616 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2619 impl From<Vec<crate::ln::msgs::NetAddress>> for CVec_NetAddressZ {
2620 fn from(v: Vec<crate::ln::msgs::NetAddress>) -> Self {
2621 let datalen = v.len();
2622 let data = Box::into_raw(v.into_boxed_slice());
2623 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2627 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2628 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
2629 impl Drop for CVec_NetAddressZ {
2630 fn drop(&mut self) {
2631 if self.datalen == 0 { return; }
2632 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2635 impl Clone for CVec_NetAddressZ {
2636 fn clone(&self) -> Self {
2637 let mut res = Vec::new();
2638 if self.datalen == 0 { return Self::from(res); }
2639 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2644 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
2645 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
2646 /// A pointer to the contents in the success state.
2647 /// Reading from this pointer when `result_ok` is not set is undefined.
2648 pub result: *mut crate::routing::network_graph::NodeAnnouncementInfo,
2649 /// A pointer to the contents in the error state.
2650 /// Reading from this pointer when `result_ok` is set is undefined.
2651 pub err: *mut crate::ln::msgs::DecodeError,
2654 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
2655 /// containing a crate::routing::network_graph::NodeAnnouncementInfo on success and a crate::ln::msgs::DecodeError on failure.
2656 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2657 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
2658 /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
2659 /// `err` or `result` depending on the state of `result_ok`.
2660 pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
2661 /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
2662 pub result_ok: bool,
2665 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
2666 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
2667 CResult_NodeAnnouncementInfoDecodeErrorZ {
2668 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
2669 result: Box::into_raw(Box::new(o)),
2675 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
2676 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
2677 CResult_NodeAnnouncementInfoDecodeErrorZ {
2678 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
2679 err: Box::into_raw(Box::new(e)),
2685 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
2686 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
2687 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
2688 fn drop(&mut self) {
2690 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2691 let _ = unsafe { Box::from_raw(self.contents.result) };
2694 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2695 let _ = unsafe { Box::from_raw(self.contents.err) };
2700 impl From<crate::c_types::CResultTempl<crate::routing::network_graph::NodeAnnouncementInfo, crate::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
2701 fn from(mut o: crate::c_types::CResultTempl<crate::routing::network_graph::NodeAnnouncementInfo, crate::ln::msgs::DecodeError>) -> Self {
2702 let contents = if o.result_ok {
2703 let result = unsafe { o.contents.result };
2704 unsafe { o.contents.result = std::ptr::null_mut() };
2705 CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
2707 let err = unsafe { o.contents.err };
2708 unsafe { o.contents.err = std::ptr::null_mut(); }
2709 CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
2713 result_ok: o.result_ok,
2717 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
2718 fn clone(&self) -> Self {
2720 Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
2721 result: Box::into_raw(Box::new(<crate::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
2724 Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
2725 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2731 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
2732 /// but with all dynamically-allocated buffers duplicated in new buffers.
2733 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { orig.clone() }
2735 /// A dynamically-allocated array of u64s of arbitrary size.
2736 /// This corresponds to std::vector in C++
2737 pub struct CVec_u64Z {
2738 /// The elements in the array.
2739 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2741 /// The number of elements pointed to by `data`.
2745 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
2746 if self.datalen == 0 { return Vec::new(); }
2747 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2748 self.data = std::ptr::null_mut();
2752 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
2753 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2756 impl From<Vec<u64>> for CVec_u64Z {
2757 fn from(v: Vec<u64>) -> Self {
2758 let datalen = v.len();
2759 let data = Box::into_raw(v.into_boxed_slice());
2760 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2764 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2765 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
2766 impl Drop for CVec_u64Z {
2767 fn drop(&mut self) {
2768 if self.datalen == 0 { return; }
2769 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2772 impl Clone for CVec_u64Z {
2773 fn clone(&self) -> Self {
2774 let mut res = Vec::new();
2775 if self.datalen == 0 { return Self::from(res); }
2776 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2781 /// The contents of CResult_NodeInfoDecodeErrorZ
2782 pub union CResult_NodeInfoDecodeErrorZPtr {
2783 /// A pointer to the contents in the success state.
2784 /// Reading from this pointer when `result_ok` is not set is undefined.
2785 pub result: *mut crate::routing::network_graph::NodeInfo,
2786 /// A pointer to the contents in the error state.
2787 /// Reading from this pointer when `result_ok` is set is undefined.
2788 pub err: *mut crate::ln::msgs::DecodeError,
2791 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
2792 /// containing a crate::routing::network_graph::NodeInfo on success and a crate::ln::msgs::DecodeError on failure.
2793 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2794 pub struct CResult_NodeInfoDecodeErrorZ {
2795 /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
2796 /// `err` or `result` depending on the state of `result_ok`.
2797 pub contents: CResult_NodeInfoDecodeErrorZPtr,
2798 /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
2799 pub result_ok: bool,
2802 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
2803 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
2804 CResult_NodeInfoDecodeErrorZ {
2805 contents: CResult_NodeInfoDecodeErrorZPtr {
2806 result: Box::into_raw(Box::new(o)),
2812 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
2813 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
2814 CResult_NodeInfoDecodeErrorZ {
2815 contents: CResult_NodeInfoDecodeErrorZPtr {
2816 err: Box::into_raw(Box::new(e)),
2822 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
2823 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
2824 impl Drop for CResult_NodeInfoDecodeErrorZ {
2825 fn drop(&mut self) {
2827 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2828 let _ = unsafe { Box::from_raw(self.contents.result) };
2831 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2832 let _ = unsafe { Box::from_raw(self.contents.err) };
2837 impl From<crate::c_types::CResultTempl<crate::routing::network_graph::NodeInfo, crate::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
2838 fn from(mut o: crate::c_types::CResultTempl<crate::routing::network_graph::NodeInfo, crate::ln::msgs::DecodeError>) -> Self {
2839 let contents = if o.result_ok {
2840 let result = unsafe { o.contents.result };
2841 unsafe { o.contents.result = std::ptr::null_mut() };
2842 CResult_NodeInfoDecodeErrorZPtr { result }
2844 let err = unsafe { o.contents.err };
2845 unsafe { o.contents.err = std::ptr::null_mut(); }
2846 CResult_NodeInfoDecodeErrorZPtr { err }
2850 result_ok: o.result_ok,
2854 impl Clone for CResult_NodeInfoDecodeErrorZ {
2855 fn clone(&self) -> Self {
2857 Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
2858 result: Box::into_raw(Box::new(<crate::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
2861 Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
2862 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2868 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
2869 /// but with all dynamically-allocated buffers duplicated in new buffers.
2870 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { orig.clone() }
2872 /// The contents of CResult_NetworkGraphDecodeErrorZ
2873 pub union CResult_NetworkGraphDecodeErrorZPtr {
2874 /// A pointer to the contents in the success state.
2875 /// Reading from this pointer when `result_ok` is not set is undefined.
2876 pub result: *mut crate::routing::network_graph::NetworkGraph,
2877 /// A pointer to the contents in the error state.
2878 /// Reading from this pointer when `result_ok` is set is undefined.
2879 pub err: *mut crate::ln::msgs::DecodeError,
2882 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
2883 /// containing a crate::routing::network_graph::NetworkGraph on success and a crate::ln::msgs::DecodeError on failure.
2884 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2885 pub struct CResult_NetworkGraphDecodeErrorZ {
2886 /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
2887 /// `err` or `result` depending on the state of `result_ok`.
2888 pub contents: CResult_NetworkGraphDecodeErrorZPtr,
2889 /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
2890 pub result_ok: bool,
2893 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
2894 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
2895 CResult_NetworkGraphDecodeErrorZ {
2896 contents: CResult_NetworkGraphDecodeErrorZPtr {
2897 result: Box::into_raw(Box::new(o)),
2903 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
2904 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
2905 CResult_NetworkGraphDecodeErrorZ {
2906 contents: CResult_NetworkGraphDecodeErrorZPtr {
2907 err: Box::into_raw(Box::new(e)),
2913 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
2914 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
2915 impl Drop for CResult_NetworkGraphDecodeErrorZ {
2916 fn drop(&mut self) {
2918 if unsafe { !(self.contents.result as *mut ()).is_null() } {
2919 let _ = unsafe { Box::from_raw(self.contents.result) };
2922 if unsafe { !(self.contents.err as *mut ()).is_null() } {
2923 let _ = unsafe { Box::from_raw(self.contents.err) };
2928 impl From<crate::c_types::CResultTempl<crate::routing::network_graph::NetworkGraph, crate::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
2929 fn from(mut o: crate::c_types::CResultTempl<crate::routing::network_graph::NetworkGraph, crate::ln::msgs::DecodeError>) -> Self {
2930 let contents = if o.result_ok {
2931 let result = unsafe { o.contents.result };
2932 unsafe { o.contents.result = std::ptr::null_mut() };
2933 CResult_NetworkGraphDecodeErrorZPtr { result }
2935 let err = unsafe { o.contents.err };
2936 unsafe { o.contents.err = std::ptr::null_mut(); }
2937 CResult_NetworkGraphDecodeErrorZPtr { err }
2941 result_ok: o.result_ok,
2945 impl Clone for CResult_NetworkGraphDecodeErrorZ {
2946 fn clone(&self) -> Self {
2948 Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
2949 result: Box::into_raw(Box::new(<crate::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
2952 Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
2953 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2959 /// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
2960 /// but with all dynamically-allocated buffers duplicated in new buffers.
2961 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { orig.clone() }
2963 /// A tuple of 2 elements. See the individual fields for the types contained.
2964 pub struct C2Tuple_usizeTransactionZ {
2965 /// The element at position 0
2967 /// The element at position 1
2968 pub b: crate::c_types::Transaction,
2970 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
2971 fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
2978 impl C2Tuple_usizeTransactionZ {
2979 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
2983 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
2985 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
2986 C2Tuple_usizeTransactionZ { a, b, }
2990 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
2991 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
2993 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
2994 /// This corresponds to std::vector in C++
2995 pub struct CVec_C2Tuple_usizeTransactionZZ {
2996 /// The elements in the array.
2997 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2998 pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
2999 /// The number of elements pointed to by `data`.
3002 impl CVec_C2Tuple_usizeTransactionZZ {
3003 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
3004 if self.datalen == 0 { return Vec::new(); }
3005 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3006 self.data = std::ptr::null_mut();
3010 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
3011 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3014 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
3015 fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
3016 let datalen = v.len();
3017 let data = Box::into_raw(v.into_boxed_slice());
3018 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3022 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3023 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
3024 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
3025 fn drop(&mut self) {
3026 if self.datalen == 0 { return; }
3027 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3031 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
3032 /// This corresponds to std::vector in C++
3033 pub struct CVec_TxidZ {
3034 /// The elements in the array.
3035 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3036 pub data: *mut crate::c_types::ThirtyTwoBytes,
3037 /// The number of elements pointed to by `data`.
3041 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
3042 if self.datalen == 0 { return Vec::new(); }
3043 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3044 self.data = std::ptr::null_mut();
3048 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
3049 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3052 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
3053 fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
3054 let datalen = v.len();
3055 let data = Box::into_raw(v.into_boxed_slice());
3056 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3060 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3061 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
3062 impl Drop for CVec_TxidZ {
3063 fn drop(&mut self) {
3064 if self.datalen == 0 { return; }
3065 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3069 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
3070 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
3071 /// Note that this value is always NULL, as there are no contents in the OK variant
3072 pub result: *mut std::ffi::c_void,
3073 /// A pointer to the contents in the error state.
3074 /// Reading from this pointer when `result_ok` is set is undefined.
3075 pub err: *mut crate::chain::channelmonitor::ChannelMonitorUpdateErr,
3078 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
3079 /// containing a () on success and a crate::chain::channelmonitor::ChannelMonitorUpdateErr on failure.
3080 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3081 pub struct CResult_NoneChannelMonitorUpdateErrZ {
3082 /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
3083 /// `err` or `result` depending on the state of `result_ok`.
3084 pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
3085 /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
3086 pub result_ok: bool,
3089 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
3090 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
3091 CResult_NoneChannelMonitorUpdateErrZ {
3092 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3093 result: std::ptr::null_mut(),
3099 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
3100 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::chain::channelmonitor::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
3101 CResult_NoneChannelMonitorUpdateErrZ {
3102 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3103 err: Box::into_raw(Box::new(e)),
3109 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
3110 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
3111 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
3112 fn drop(&mut self) {
3115 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3116 let _ = unsafe { Box::from_raw(self.contents.err) };
3121 impl From<crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
3122 fn from(mut o: crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::ChannelMonitorUpdateErr>) -> Self {
3123 let contents = if o.result_ok {
3124 let _ = unsafe { Box::from_raw(o.contents.result) };
3125 o.contents.result = std::ptr::null_mut();
3126 CResult_NoneChannelMonitorUpdateErrZPtr { result: std::ptr::null_mut() }
3128 let err = unsafe { o.contents.err };
3129 unsafe { o.contents.err = std::ptr::null_mut(); }
3130 CResult_NoneChannelMonitorUpdateErrZPtr { err }
3134 result_ok: o.result_ok,
3138 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
3139 fn clone(&self) -> Self {
3141 Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3142 result: std::ptr::null_mut()
3145 Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3146 err: Box::into_raw(Box::new(<crate::chain::channelmonitor::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
3152 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
3153 /// but with all dynamically-allocated buffers duplicated in new buffers.
3154 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { orig.clone() }
3156 /// A dynamically-allocated array of crate::chain::channelmonitor::MonitorEvents of arbitrary size.
3157 /// This corresponds to std::vector in C++
3158 pub struct CVec_MonitorEventZ {
3159 /// The elements in the array.
3160 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3161 pub data: *mut crate::chain::channelmonitor::MonitorEvent,
3162 /// The number of elements pointed to by `data`.
3165 impl CVec_MonitorEventZ {
3166 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::chain::channelmonitor::MonitorEvent> {
3167 if self.datalen == 0 { return Vec::new(); }
3168 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3169 self.data = std::ptr::null_mut();
3173 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::chain::channelmonitor::MonitorEvent] {
3174 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3177 impl From<Vec<crate::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
3178 fn from(v: Vec<crate::chain::channelmonitor::MonitorEvent>) -> Self {
3179 let datalen = v.len();
3180 let data = Box::into_raw(v.into_boxed_slice());
3181 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3185 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3186 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
3187 impl Drop for CVec_MonitorEventZ {
3188 fn drop(&mut self) {
3189 if self.datalen == 0 { return; }
3190 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3193 impl Clone for CVec_MonitorEventZ {
3194 fn clone(&self) -> Self {
3195 let mut res = Vec::new();
3196 if self.datalen == 0 { return Self::from(res); }
3197 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3202 /// A dynamically-allocated array of crate::util::events::Events of arbitrary size.
3203 /// This corresponds to std::vector in C++
3204 pub struct CVec_EventZ {
3205 /// The elements in the array.
3206 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3207 pub data: *mut crate::util::events::Event,
3208 /// The number of elements pointed to by `data`.
3212 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::util::events::Event> {
3213 if self.datalen == 0 { return Vec::new(); }
3214 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3215 self.data = std::ptr::null_mut();
3219 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::util::events::Event] {
3220 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3223 impl From<Vec<crate::util::events::Event>> for CVec_EventZ {
3224 fn from(v: Vec<crate::util::events::Event>) -> Self {
3225 let datalen = v.len();
3226 let data = Box::into_raw(v.into_boxed_slice());
3227 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3231 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3232 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
3233 impl Drop for CVec_EventZ {
3234 fn drop(&mut self) {
3235 if self.datalen == 0 { return; }
3236 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3239 impl Clone for CVec_EventZ {
3240 fn clone(&self) -> Self {
3241 let mut res = Vec::new();
3242 if self.datalen == 0 { return Self::from(res); }
3243 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3248 /// The contents of CResult_OutPointDecodeErrorZ
3249 pub union CResult_OutPointDecodeErrorZPtr {
3250 /// A pointer to the contents in the success state.
3251 /// Reading from this pointer when `result_ok` is not set is undefined.
3252 pub result: *mut crate::chain::transaction::OutPoint,
3253 /// A pointer to the contents in the error state.
3254 /// Reading from this pointer when `result_ok` is set is undefined.
3255 pub err: *mut crate::ln::msgs::DecodeError,
3258 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
3259 /// containing a crate::chain::transaction::OutPoint on success and a crate::ln::msgs::DecodeError on failure.
3260 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3261 pub struct CResult_OutPointDecodeErrorZ {
3262 /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
3263 /// `err` or `result` depending on the state of `result_ok`.
3264 pub contents: CResult_OutPointDecodeErrorZPtr,
3265 /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
3266 pub result_ok: bool,
3269 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
3270 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
3271 CResult_OutPointDecodeErrorZ {
3272 contents: CResult_OutPointDecodeErrorZPtr {
3273 result: Box::into_raw(Box::new(o)),
3279 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
3280 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
3281 CResult_OutPointDecodeErrorZ {
3282 contents: CResult_OutPointDecodeErrorZPtr {
3283 err: Box::into_raw(Box::new(e)),
3289 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
3290 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
3291 impl Drop for CResult_OutPointDecodeErrorZ {
3292 fn drop(&mut self) {
3294 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3295 let _ = unsafe { Box::from_raw(self.contents.result) };
3298 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3299 let _ = unsafe { Box::from_raw(self.contents.err) };
3304 impl From<crate::c_types::CResultTempl<crate::chain::transaction::OutPoint, crate::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
3305 fn from(mut o: crate::c_types::CResultTempl<crate::chain::transaction::OutPoint, crate::ln::msgs::DecodeError>) -> Self {
3306 let contents = if o.result_ok {
3307 let result = unsafe { o.contents.result };
3308 unsafe { o.contents.result = std::ptr::null_mut() };
3309 CResult_OutPointDecodeErrorZPtr { result }
3311 let err = unsafe { o.contents.err };
3312 unsafe { o.contents.err = std::ptr::null_mut(); }
3313 CResult_OutPointDecodeErrorZPtr { err }
3317 result_ok: o.result_ok,
3321 impl Clone for CResult_OutPointDecodeErrorZ {
3322 fn clone(&self) -> Self {
3324 Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
3325 result: Box::into_raw(Box::new(<crate::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
3328 Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
3329 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3335 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
3336 /// but with all dynamically-allocated buffers duplicated in new buffers.
3337 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { orig.clone() }
3339 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
3340 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
3341 /// A pointer to the contents in the success state.
3342 /// Reading from this pointer when `result_ok` is not set is undefined.
3343 pub result: *mut crate::chain::channelmonitor::ChannelMonitorUpdate,
3344 /// A pointer to the contents in the error state.
3345 /// Reading from this pointer when `result_ok` is set is undefined.
3346 pub err: *mut crate::ln::msgs::DecodeError,
3349 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
3350 /// containing a crate::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::ln::msgs::DecodeError on failure.
3351 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3352 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
3353 /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
3354 /// `err` or `result` depending on the state of `result_ok`.
3355 pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
3356 /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
3357 pub result_ok: bool,
3360 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
3361 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
3362 CResult_ChannelMonitorUpdateDecodeErrorZ {
3363 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
3364 result: Box::into_raw(Box::new(o)),
3370 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
3371 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
3372 CResult_ChannelMonitorUpdateDecodeErrorZ {
3373 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
3374 err: Box::into_raw(Box::new(e)),
3380 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
3381 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
3382 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
3383 fn drop(&mut self) {
3385 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3386 let _ = unsafe { Box::from_raw(self.contents.result) };
3389 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3390 let _ = unsafe { Box::from_raw(self.contents.err) };
3395 impl From<crate::c_types::CResultTempl<crate::chain::channelmonitor::ChannelMonitorUpdate, crate::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
3396 fn from(mut o: crate::c_types::CResultTempl<crate::chain::channelmonitor::ChannelMonitorUpdate, crate::ln::msgs::DecodeError>) -> Self {
3397 let contents = if o.result_ok {
3398 let result = unsafe { o.contents.result };
3399 unsafe { o.contents.result = std::ptr::null_mut() };
3400 CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
3402 let err = unsafe { o.contents.err };
3403 unsafe { o.contents.err = std::ptr::null_mut(); }
3404 CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
3408 result_ok: o.result_ok,
3412 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
3413 fn clone(&self) -> Self {
3415 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
3416 result: Box::into_raw(Box::new(<crate::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
3419 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
3420 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3426 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
3427 /// but with all dynamically-allocated buffers duplicated in new buffers.
3428 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { orig.clone() }
3430 /// The contents of CResult_HTLCUpdateDecodeErrorZ
3431 pub union CResult_HTLCUpdateDecodeErrorZPtr {
3432 /// A pointer to the contents in the success state.
3433 /// Reading from this pointer when `result_ok` is not set is undefined.
3434 pub result: *mut crate::chain::channelmonitor::HTLCUpdate,
3435 /// A pointer to the contents in the error state.
3436 /// Reading from this pointer when `result_ok` is set is undefined.
3437 pub err: *mut crate::ln::msgs::DecodeError,
3440 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
3441 /// containing a crate::chain::channelmonitor::HTLCUpdate on success and a crate::ln::msgs::DecodeError on failure.
3442 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3443 pub struct CResult_HTLCUpdateDecodeErrorZ {
3444 /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
3445 /// `err` or `result` depending on the state of `result_ok`.
3446 pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
3447 /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
3448 pub result_ok: bool,
3451 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
3452 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
3453 CResult_HTLCUpdateDecodeErrorZ {
3454 contents: CResult_HTLCUpdateDecodeErrorZPtr {
3455 result: Box::into_raw(Box::new(o)),
3461 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
3462 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
3463 CResult_HTLCUpdateDecodeErrorZ {
3464 contents: CResult_HTLCUpdateDecodeErrorZPtr {
3465 err: Box::into_raw(Box::new(e)),
3471 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
3472 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
3473 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
3474 fn drop(&mut self) {
3476 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3477 let _ = unsafe { Box::from_raw(self.contents.result) };
3480 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3481 let _ = unsafe { Box::from_raw(self.contents.err) };
3486 impl From<crate::c_types::CResultTempl<crate::chain::channelmonitor::HTLCUpdate, crate::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
3487 fn from(mut o: crate::c_types::CResultTempl<crate::chain::channelmonitor::HTLCUpdate, crate::ln::msgs::DecodeError>) -> Self {
3488 let contents = if o.result_ok {
3489 let result = unsafe { o.contents.result };
3490 unsafe { o.contents.result = std::ptr::null_mut() };
3491 CResult_HTLCUpdateDecodeErrorZPtr { result }
3493 let err = unsafe { o.contents.err };
3494 unsafe { o.contents.err = std::ptr::null_mut(); }
3495 CResult_HTLCUpdateDecodeErrorZPtr { err }
3499 result_ok: o.result_ok,
3503 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
3504 fn clone(&self) -> Self {
3506 Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
3507 result: Box::into_raw(Box::new(<crate::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
3510 Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
3511 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3517 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
3518 /// but with all dynamically-allocated buffers duplicated in new buffers.
3519 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { orig.clone() }
3521 /// The contents of CResult_NoneMonitorUpdateErrorZ
3522 pub union CResult_NoneMonitorUpdateErrorZPtr {
3523 /// Note that this value is always NULL, as there are no contents in the OK variant
3524 pub result: *mut std::ffi::c_void,
3525 /// A pointer to the contents in the error state.
3526 /// Reading from this pointer when `result_ok` is set is undefined.
3527 pub err: *mut crate::chain::channelmonitor::MonitorUpdateError,
3530 /// A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
3531 /// containing a () on success and a crate::chain::channelmonitor::MonitorUpdateError on failure.
3532 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3533 pub struct CResult_NoneMonitorUpdateErrorZ {
3534 /// The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
3535 /// `err` or `result` depending on the state of `result_ok`.
3536 pub contents: CResult_NoneMonitorUpdateErrorZPtr,
3537 /// Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
3538 pub result_ok: bool,
3541 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
3542 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_ok() -> CResult_NoneMonitorUpdateErrorZ {
3543 CResult_NoneMonitorUpdateErrorZ {
3544 contents: CResult_NoneMonitorUpdateErrorZPtr {
3545 result: std::ptr::null_mut(),
3551 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
3552 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_err(e: crate::chain::channelmonitor::MonitorUpdateError) -> CResult_NoneMonitorUpdateErrorZ {
3553 CResult_NoneMonitorUpdateErrorZ {
3554 contents: CResult_NoneMonitorUpdateErrorZPtr {
3555 err: Box::into_raw(Box::new(e)),
3561 /// Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
3562 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_free(_res: CResult_NoneMonitorUpdateErrorZ) { }
3563 impl Drop for CResult_NoneMonitorUpdateErrorZ {
3564 fn drop(&mut self) {
3567 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3568 let _ = unsafe { Box::from_raw(self.contents.err) };
3573 impl From<crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::MonitorUpdateError>> for CResult_NoneMonitorUpdateErrorZ {
3574 fn from(mut o: crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::MonitorUpdateError>) -> Self {
3575 let contents = if o.result_ok {
3576 let _ = unsafe { Box::from_raw(o.contents.result) };
3577 o.contents.result = std::ptr::null_mut();
3578 CResult_NoneMonitorUpdateErrorZPtr { result: std::ptr::null_mut() }
3580 let err = unsafe { o.contents.err };
3581 unsafe { o.contents.err = std::ptr::null_mut(); }
3582 CResult_NoneMonitorUpdateErrorZPtr { err }
3586 result_ok: o.result_ok,
3590 impl Clone for CResult_NoneMonitorUpdateErrorZ {
3591 fn clone(&self) -> Self {
3593 Self { result_ok: true, contents: CResult_NoneMonitorUpdateErrorZPtr {
3594 result: std::ptr::null_mut()
3597 Self { result_ok: false, contents: CResult_NoneMonitorUpdateErrorZPtr {
3598 err: Box::into_raw(Box::new(<crate::chain::channelmonitor::MonitorUpdateError>::clone(unsafe { &*self.contents.err })))
3604 /// Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
3605 /// but with all dynamically-allocated buffers duplicated in new buffers.
3606 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_clone(orig: &CResult_NoneMonitorUpdateErrorZ) -> CResult_NoneMonitorUpdateErrorZ { orig.clone() }
3608 /// A tuple of 2 elements. See the individual fields for the types contained.
3609 pub struct C2Tuple_OutPointScriptZ {
3610 /// The element at position 0
3611 pub a: crate::chain::transaction::OutPoint,
3612 /// The element at position 1
3613 pub b: crate::c_types::derived::CVec_u8Z,
3615 impl From<(crate::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
3616 fn from (tup: (crate::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
3623 impl C2Tuple_OutPointScriptZ {
3624 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
3628 impl Clone for C2Tuple_OutPointScriptZ {
3629 fn clone(&self) -> Self {
3637 /// Creates a new tuple which has the same data as `orig`
3638 /// but with all dynamically-allocated buffers duplicated in new buffers.
3639 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { orig.clone() }
3640 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
3642 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
3643 C2Tuple_OutPointScriptZ { a, b, }
3647 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
3648 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
3650 /// A tuple of 2 elements. See the individual fields for the types contained.
3651 pub struct C2Tuple_u32ScriptZ {
3652 /// The element at position 0
3654 /// The element at position 1
3655 pub b: crate::c_types::derived::CVec_u8Z,
3657 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
3658 fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
3665 impl C2Tuple_u32ScriptZ {
3666 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
3670 impl Clone for C2Tuple_u32ScriptZ {
3671 fn clone(&self) -> Self {
3679 /// Creates a new tuple which has the same data as `orig`
3680 /// but with all dynamically-allocated buffers duplicated in new buffers.
3681 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { orig.clone() }
3682 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
3684 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
3685 C2Tuple_u32ScriptZ { a, b, }
3689 /// Frees any resources used by the C2Tuple_u32ScriptZ.
3690 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
3692 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
3693 /// This corresponds to std::vector in C++
3694 pub struct CVec_C2Tuple_u32ScriptZZ {
3695 /// The elements in the array.
3696 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3697 pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
3698 /// The number of elements pointed to by `data`.
3701 impl CVec_C2Tuple_u32ScriptZZ {
3702 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
3703 if self.datalen == 0 { return Vec::new(); }
3704 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3705 self.data = std::ptr::null_mut();
3709 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
3710 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3713 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
3714 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
3715 let datalen = v.len();
3716 let data = Box::into_raw(v.into_boxed_slice());
3717 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3721 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3722 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
3723 impl Drop for CVec_C2Tuple_u32ScriptZZ {
3724 fn drop(&mut self) {
3725 if self.datalen == 0 { return; }
3726 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3729 impl Clone for CVec_C2Tuple_u32ScriptZZ {
3730 fn clone(&self) -> Self {
3731 let mut res = Vec::new();
3732 if self.datalen == 0 { return Self::from(res); }
3733 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3738 /// A tuple of 2 elements. See the individual fields for the types contained.
3739 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
3740 /// The element at position 0
3741 pub a: crate::c_types::ThirtyTwoBytes,
3742 /// The element at position 1
3743 pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
3745 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
3746 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
3753 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
3754 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
3758 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
3760 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 {
3761 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
3765 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
3766 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
3768 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
3769 /// This corresponds to std::vector in C++
3770 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
3771 /// The elements in the array.
3772 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3773 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
3774 /// The number of elements pointed to by `data`.
3777 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
3778 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
3779 if self.datalen == 0 { return Vec::new(); }
3780 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3781 self.data = std::ptr::null_mut();
3785 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
3786 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3789 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
3790 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
3791 let datalen = v.len();
3792 let data = Box::into_raw(v.into_boxed_slice());
3793 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3797 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3798 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
3799 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
3800 fn drop(&mut self) {
3801 if self.datalen == 0 { return; }
3802 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3806 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
3807 /// This corresponds to std::vector in C++
3808 pub struct CVec_TransactionZ {
3809 /// The elements in the array.
3810 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3811 pub data: *mut crate::c_types::Transaction,
3812 /// The number of elements pointed to by `data`.
3815 impl CVec_TransactionZ {
3816 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
3817 if self.datalen == 0 { return Vec::new(); }
3818 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3819 self.data = std::ptr::null_mut();
3823 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
3824 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3827 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
3828 fn from(v: Vec<crate::c_types::Transaction>) -> Self {
3829 let datalen = v.len();
3830 let data = Box::into_raw(v.into_boxed_slice());
3831 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3835 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3836 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
3837 impl Drop for CVec_TransactionZ {
3838 fn drop(&mut self) {
3839 if self.datalen == 0 { return; }
3840 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3844 /// A tuple of 2 elements. See the individual fields for the types contained.
3845 pub struct C2Tuple_u32TxOutZ {
3846 /// The element at position 0
3848 /// The element at position 1
3849 pub b: crate::c_types::TxOut,
3851 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
3852 fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
3859 impl C2Tuple_u32TxOutZ {
3860 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
3864 impl Clone for C2Tuple_u32TxOutZ {
3865 fn clone(&self) -> Self {
3873 /// Creates a new tuple which has the same data as `orig`
3874 /// but with all dynamically-allocated buffers duplicated in new buffers.
3875 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { orig.clone() }
3876 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
3878 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
3879 C2Tuple_u32TxOutZ { a, b, }
3883 /// Frees any resources used by the C2Tuple_u32TxOutZ.
3884 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
3886 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
3887 /// This corresponds to std::vector in C++
3888 pub struct CVec_C2Tuple_u32TxOutZZ {
3889 /// The elements in the array.
3890 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3891 pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
3892 /// The number of elements pointed to by `data`.
3895 impl CVec_C2Tuple_u32TxOutZZ {
3896 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
3897 if self.datalen == 0 { return Vec::new(); }
3898 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3899 self.data = std::ptr::null_mut();
3903 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
3904 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3907 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
3908 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
3909 let datalen = v.len();
3910 let data = Box::into_raw(v.into_boxed_slice());
3911 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3915 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3916 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
3917 impl Drop for CVec_C2Tuple_u32TxOutZZ {
3918 fn drop(&mut self) {
3919 if self.datalen == 0 { return; }
3920 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3923 impl Clone for CVec_C2Tuple_u32TxOutZZ {
3924 fn clone(&self) -> Self {
3925 let mut res = Vec::new();
3926 if self.datalen == 0 { return Self::from(res); }
3927 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3932 /// A tuple of 2 elements. See the individual fields for the types contained.
3933 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
3934 /// The element at position 0
3935 pub a: crate::c_types::ThirtyTwoBytes,
3936 /// The element at position 1
3937 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
3939 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
3940 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
3947 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
3948 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
3952 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
3954 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 {
3955 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
3959 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
3960 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
3962 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
3963 /// This corresponds to std::vector in C++
3964 pub struct CVec_TransactionOutputsZ {
3965 /// The elements in the array.
3966 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3967 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
3968 /// The number of elements pointed to by `data`.
3971 impl CVec_TransactionOutputsZ {
3972 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
3973 if self.datalen == 0 { return Vec::new(); }
3974 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3975 self.data = std::ptr::null_mut();
3979 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
3980 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3983 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
3984 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
3985 let datalen = v.len();
3986 let data = Box::into_raw(v.into_boxed_slice());
3987 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3991 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3992 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
3993 impl Drop for CVec_TransactionOutputsZ {
3994 fn drop(&mut self) {
3995 if self.datalen == 0 { return; }
3996 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4000 /// A tuple of 2 elements. See the individual fields for the types contained.
4001 pub struct C2Tuple_BlockHashChannelMonitorZ {
4002 /// The element at position 0
4003 pub a: crate::c_types::ThirtyTwoBytes,
4004 /// The element at position 1
4005 pub b: crate::chain::channelmonitor::ChannelMonitor,
4007 impl From<(crate::c_types::ThirtyTwoBytes, crate::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
4008 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::chain::channelmonitor::ChannelMonitor)) -> Self {
4015 impl C2Tuple_BlockHashChannelMonitorZ {
4016 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::chain::channelmonitor::ChannelMonitor) {
4020 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
4022 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
4023 C2Tuple_BlockHashChannelMonitorZ { a, b, }
4027 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
4028 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
4030 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
4031 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
4032 /// A pointer to the contents in the success state.
4033 /// Reading from this pointer when `result_ok` is not set is undefined.
4034 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
4035 /// A pointer to the contents in the error state.
4036 /// Reading from this pointer when `result_ok` is set is undefined.
4037 pub err: *mut crate::ln::msgs::DecodeError,
4040 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
4041 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::ln::msgs::DecodeError on failure.
4042 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4043 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
4044 /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
4045 /// `err` or `result` depending on the state of `result_ok`.
4046 pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
4047 /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
4048 pub result_ok: bool,
4051 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
4052 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
4053 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
4054 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
4055 result: Box::into_raw(Box::new(o)),
4061 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
4062 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
4063 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
4064 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
4065 err: Box::into_raw(Box::new(e)),
4071 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
4072 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
4073 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
4074 fn drop(&mut self) {
4076 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4077 let _ = unsafe { Box::from_raw(self.contents.result) };
4080 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4081 let _ = unsafe { Box::from_raw(self.contents.err) };
4086 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
4087 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::ln::msgs::DecodeError>) -> Self {
4088 let contents = if o.result_ok {
4089 let result = unsafe { o.contents.result };
4090 unsafe { o.contents.result = std::ptr::null_mut() };
4091 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
4093 let err = unsafe { o.contents.err };
4094 unsafe { o.contents.err = std::ptr::null_mut(); }
4095 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
4099 result_ok: o.result_ok,
4104 /// A dynamically-allocated array of crate::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
4105 /// This corresponds to std::vector in C++
4106 pub struct CVec_SpendableOutputDescriptorZ {
4107 /// The elements in the array.
4108 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4109 pub data: *mut crate::chain::keysinterface::SpendableOutputDescriptor,
4110 /// The number of elements pointed to by `data`.
4113 impl CVec_SpendableOutputDescriptorZ {
4114 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::chain::keysinterface::SpendableOutputDescriptor> {
4115 if self.datalen == 0 { return Vec::new(); }
4116 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4117 self.data = std::ptr::null_mut();
4121 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::chain::keysinterface::SpendableOutputDescriptor] {
4122 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4125 impl From<Vec<crate::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
4126 fn from(v: Vec<crate::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
4127 let datalen = v.len();
4128 let data = Box::into_raw(v.into_boxed_slice());
4129 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4133 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4134 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
4135 impl Drop for CVec_SpendableOutputDescriptorZ {
4136 fn drop(&mut self) {
4137 if self.datalen == 0 { return; }
4138 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4141 impl Clone for CVec_SpendableOutputDescriptorZ {
4142 fn clone(&self) -> Self {
4143 let mut res = Vec::new();
4144 if self.datalen == 0 { return Self::from(res); }
4145 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4150 /// The contents of CResult_TxOutAccessErrorZ
4151 pub union CResult_TxOutAccessErrorZPtr {
4152 /// A pointer to the contents in the success state.
4153 /// Reading from this pointer when `result_ok` is not set is undefined.
4154 pub result: *mut crate::c_types::TxOut,
4155 /// A pointer to the contents in the error state.
4156 /// Reading from this pointer when `result_ok` is set is undefined.
4157 pub err: *mut crate::chain::AccessError,
4160 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
4161 /// containing a crate::c_types::TxOut on success and a crate::chain::AccessError on failure.
4162 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4163 pub struct CResult_TxOutAccessErrorZ {
4164 /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
4165 /// `err` or `result` depending on the state of `result_ok`.
4166 pub contents: CResult_TxOutAccessErrorZPtr,
4167 /// Whether this CResult_TxOutAccessErrorZ represents a success state.
4168 pub result_ok: bool,
4171 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
4172 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
4173 CResult_TxOutAccessErrorZ {
4174 contents: CResult_TxOutAccessErrorZPtr {
4175 result: Box::into_raw(Box::new(o)),
4181 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
4182 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::chain::AccessError) -> CResult_TxOutAccessErrorZ {
4183 CResult_TxOutAccessErrorZ {
4184 contents: CResult_TxOutAccessErrorZPtr {
4185 err: Box::into_raw(Box::new(e)),
4191 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
4192 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
4193 impl Drop for CResult_TxOutAccessErrorZ {
4194 fn drop(&mut self) {
4196 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4197 let _ = unsafe { Box::from_raw(self.contents.result) };
4200 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4201 let _ = unsafe { Box::from_raw(self.contents.err) };
4206 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::chain::AccessError>> for CResult_TxOutAccessErrorZ {
4207 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::chain::AccessError>) -> Self {
4208 let contents = if o.result_ok {
4209 let result = unsafe { o.contents.result };
4210 unsafe { o.contents.result = std::ptr::null_mut() };
4211 CResult_TxOutAccessErrorZPtr { result }
4213 let err = unsafe { o.contents.err };
4214 unsafe { o.contents.err = std::ptr::null_mut(); }
4215 CResult_TxOutAccessErrorZPtr { err }
4219 result_ok: o.result_ok,
4223 impl Clone for CResult_TxOutAccessErrorZ {
4224 fn clone(&self) -> Self {
4226 Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
4227 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
4230 Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
4231 err: Box::into_raw(Box::new(<crate::chain::AccessError>::clone(unsafe { &*self.contents.err })))
4237 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
4238 /// but with all dynamically-allocated buffers duplicated in new buffers.
4239 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { orig.clone() }
4241 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
4242 pub enum COption_C2Tuple_usizeTransactionZZ {
4243 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
4244 Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
4245 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
4248 impl COption_C2Tuple_usizeTransactionZZ {
4249 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4250 if let Self::Some(_) = self { true } else { false }
4252 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
4253 if let Self::Some(v) = self { v } else { unreachable!() }
4257 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
4258 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
4259 COption_C2Tuple_usizeTransactionZZ::Some(o)
4262 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
4263 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
4264 COption_C2Tuple_usizeTransactionZZ::None
4267 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
4268 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
4270 /// The contents of CResult_NoneAPIErrorZ
4271 pub union CResult_NoneAPIErrorZPtr {
4272 /// Note that this value is always NULL, as there are no contents in the OK variant
4273 pub result: *mut std::ffi::c_void,
4274 /// A pointer to the contents in the error state.
4275 /// Reading from this pointer when `result_ok` is set is undefined.
4276 pub err: *mut crate::util::errors::APIError,
4279 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
4280 /// containing a () on success and a crate::util::errors::APIError on failure.
4281 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4282 pub struct CResult_NoneAPIErrorZ {
4283 /// The contents of this CResult_NoneAPIErrorZ, accessible via either
4284 /// `err` or `result` depending on the state of `result_ok`.
4285 pub contents: CResult_NoneAPIErrorZPtr,
4286 /// Whether this CResult_NoneAPIErrorZ represents a success state.
4287 pub result_ok: bool,
4290 /// Creates a new CResult_NoneAPIErrorZ in the success state.
4291 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
4292 CResult_NoneAPIErrorZ {
4293 contents: CResult_NoneAPIErrorZPtr {
4294 result: std::ptr::null_mut(),
4300 /// Creates a new CResult_NoneAPIErrorZ in the error state.
4301 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::util::errors::APIError) -> CResult_NoneAPIErrorZ {
4302 CResult_NoneAPIErrorZ {
4303 contents: CResult_NoneAPIErrorZPtr {
4304 err: Box::into_raw(Box::new(e)),
4310 /// Frees any resources used by the CResult_NoneAPIErrorZ.
4311 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
4312 impl Drop for CResult_NoneAPIErrorZ {
4313 fn drop(&mut self) {
4316 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4317 let _ = unsafe { Box::from_raw(self.contents.err) };
4322 impl From<crate::c_types::CResultTempl<u8, crate::util::errors::APIError>> for CResult_NoneAPIErrorZ {
4323 fn from(mut o: crate::c_types::CResultTempl<u8, crate::util::errors::APIError>) -> Self {
4324 let contents = if o.result_ok {
4325 let _ = unsafe { Box::from_raw(o.contents.result) };
4326 o.contents.result = std::ptr::null_mut();
4327 CResult_NoneAPIErrorZPtr { result: std::ptr::null_mut() }
4329 let err = unsafe { o.contents.err };
4330 unsafe { o.contents.err = std::ptr::null_mut(); }
4331 CResult_NoneAPIErrorZPtr { err }
4335 result_ok: o.result_ok,
4339 impl Clone for CResult_NoneAPIErrorZ {
4340 fn clone(&self) -> Self {
4342 Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
4343 result: std::ptr::null_mut()
4346 Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
4347 err: Box::into_raw(Box::new(<crate::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
4353 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
4354 /// but with all dynamically-allocated buffers duplicated in new buffers.
4355 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { orig.clone() }
4357 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
4358 /// This corresponds to std::vector in C++
4359 pub struct CVec_CResult_NoneAPIErrorZZ {
4360 /// The elements in the array.
4361 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4362 pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
4363 /// The number of elements pointed to by `data`.
4366 impl CVec_CResult_NoneAPIErrorZZ {
4367 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
4368 if self.datalen == 0 { return Vec::new(); }
4369 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4370 self.data = std::ptr::null_mut();
4374 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
4375 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4378 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
4379 fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
4380 let datalen = v.len();
4381 let data = Box::into_raw(v.into_boxed_slice());
4382 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4386 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4387 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
4388 impl Drop for CVec_CResult_NoneAPIErrorZZ {
4389 fn drop(&mut self) {
4390 if self.datalen == 0 { return; }
4391 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4394 impl Clone for CVec_CResult_NoneAPIErrorZZ {
4395 fn clone(&self) -> Self {
4396 let mut res = Vec::new();
4397 if self.datalen == 0 { return Self::from(res); }
4398 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4403 /// A dynamically-allocated array of crate::util::errors::APIErrors of arbitrary size.
4404 /// This corresponds to std::vector in C++
4405 pub struct CVec_APIErrorZ {
4406 /// The elements in the array.
4407 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4408 pub data: *mut crate::util::errors::APIError,
4409 /// The number of elements pointed to by `data`.
4412 impl CVec_APIErrorZ {
4413 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::util::errors::APIError> {
4414 if self.datalen == 0 { return Vec::new(); }
4415 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4416 self.data = std::ptr::null_mut();
4420 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::util::errors::APIError] {
4421 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4424 impl From<Vec<crate::util::errors::APIError>> for CVec_APIErrorZ {
4425 fn from(v: Vec<crate::util::errors::APIError>) -> Self {
4426 let datalen = v.len();
4427 let data = Box::into_raw(v.into_boxed_slice());
4428 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4432 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4433 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
4434 impl Drop for CVec_APIErrorZ {
4435 fn drop(&mut self) {
4436 if self.datalen == 0 { return; }
4437 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4440 impl Clone for CVec_APIErrorZ {
4441 fn clone(&self) -> Self {
4442 let mut res = Vec::new();
4443 if self.datalen == 0 { return Self::from(res); }
4444 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4449 /// A dynamically-allocated array of crate::ln::channelmanager::ChannelDetailss of arbitrary size.
4450 /// This corresponds to std::vector in C++
4451 pub struct CVec_ChannelDetailsZ {
4452 /// The elements in the array.
4453 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4454 pub data: *mut crate::ln::channelmanager::ChannelDetails,
4455 /// The number of elements pointed to by `data`.
4458 impl CVec_ChannelDetailsZ {
4459 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::channelmanager::ChannelDetails> {
4460 if self.datalen == 0 { return Vec::new(); }
4461 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4462 self.data = std::ptr::null_mut();
4466 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::channelmanager::ChannelDetails] {
4467 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4470 impl From<Vec<crate::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
4471 fn from(v: Vec<crate::ln::channelmanager::ChannelDetails>) -> Self {
4472 let datalen = v.len();
4473 let data = Box::into_raw(v.into_boxed_slice());
4474 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4478 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4479 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
4480 impl Drop for CVec_ChannelDetailsZ {
4481 fn drop(&mut self) {
4482 if self.datalen == 0 { return; }
4483 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4486 impl Clone for CVec_ChannelDetailsZ {
4487 fn clone(&self) -> Self {
4488 let mut res = Vec::new();
4489 if self.datalen == 0 { return Self::from(res); }
4490 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4495 /// The contents of CResult_NonePaymentSendFailureZ
4496 pub union CResult_NonePaymentSendFailureZPtr {
4497 /// Note that this value is always NULL, as there are no contents in the OK variant
4498 pub result: *mut std::ffi::c_void,
4499 /// A pointer to the contents in the error state.
4500 /// Reading from this pointer when `result_ok` is set is undefined.
4501 pub err: *mut crate::ln::channelmanager::PaymentSendFailure,
4504 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
4505 /// containing a () on success and a crate::ln::channelmanager::PaymentSendFailure on failure.
4506 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4507 pub struct CResult_NonePaymentSendFailureZ {
4508 /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
4509 /// `err` or `result` depending on the state of `result_ok`.
4510 pub contents: CResult_NonePaymentSendFailureZPtr,
4511 /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
4512 pub result_ok: bool,
4515 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
4516 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
4517 CResult_NonePaymentSendFailureZ {
4518 contents: CResult_NonePaymentSendFailureZPtr {
4519 result: std::ptr::null_mut(),
4525 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
4526 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
4527 CResult_NonePaymentSendFailureZ {
4528 contents: CResult_NonePaymentSendFailureZPtr {
4529 err: Box::into_raw(Box::new(e)),
4535 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
4536 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
4537 impl Drop for CResult_NonePaymentSendFailureZ {
4538 fn drop(&mut self) {
4541 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4542 let _ = unsafe { Box::from_raw(self.contents.err) };
4547 impl From<crate::c_types::CResultTempl<u8, crate::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
4548 fn from(mut o: crate::c_types::CResultTempl<u8, crate::ln::channelmanager::PaymentSendFailure>) -> Self {
4549 let contents = if o.result_ok {
4550 let _ = unsafe { Box::from_raw(o.contents.result) };
4551 o.contents.result = std::ptr::null_mut();
4552 CResult_NonePaymentSendFailureZPtr { result: std::ptr::null_mut() }
4554 let err = unsafe { o.contents.err };
4555 unsafe { o.contents.err = std::ptr::null_mut(); }
4556 CResult_NonePaymentSendFailureZPtr { err }
4560 result_ok: o.result_ok,
4564 impl Clone for CResult_NonePaymentSendFailureZ {
4565 fn clone(&self) -> Self {
4567 Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
4568 result: std::ptr::null_mut()
4571 Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
4572 err: Box::into_raw(Box::new(<crate::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
4578 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
4579 /// but with all dynamically-allocated buffers duplicated in new buffers.
4580 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { orig.clone() }
4582 /// A dynamically-allocated array of crate::chain::channelmonitor::ChannelMonitors of arbitrary size.
4583 /// This corresponds to std::vector in C++
4584 pub struct CVec_ChannelMonitorZ {
4585 /// The elements in the array.
4586 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4587 pub data: *mut crate::chain::channelmonitor::ChannelMonitor,
4588 /// The number of elements pointed to by `data`.
4591 impl CVec_ChannelMonitorZ {
4592 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::chain::channelmonitor::ChannelMonitor> {
4593 if self.datalen == 0 { return Vec::new(); }
4594 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4595 self.data = std::ptr::null_mut();
4599 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::chain::channelmonitor::ChannelMonitor] {
4600 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4603 impl From<Vec<crate::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
4604 fn from(v: Vec<crate::chain::channelmonitor::ChannelMonitor>) -> Self {
4605 let datalen = v.len();
4606 let data = Box::into_raw(v.into_boxed_slice());
4607 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4611 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4612 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
4613 impl Drop for CVec_ChannelMonitorZ {
4614 fn drop(&mut self) {
4615 if self.datalen == 0 { return; }
4616 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4620 /// A tuple of 2 elements. See the individual fields for the types contained.
4621 pub struct C2Tuple_BlockHashChannelManagerZ {
4622 /// The element at position 0
4623 pub a: crate::c_types::ThirtyTwoBytes,
4624 /// The element at position 1
4625 pub b: crate::ln::channelmanager::ChannelManager,
4627 impl From<(crate::c_types::ThirtyTwoBytes, crate::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
4628 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::ln::channelmanager::ChannelManager)) -> Self {
4635 impl C2Tuple_BlockHashChannelManagerZ {
4636 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::ln::channelmanager::ChannelManager) {
4640 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
4642 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
4643 C2Tuple_BlockHashChannelManagerZ { a, b, }
4647 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
4648 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
4650 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
4651 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4652 /// A pointer to the contents in the success state.
4653 /// Reading from this pointer when `result_ok` is not set is undefined.
4654 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
4655 /// A pointer to the contents in the error state.
4656 /// Reading from this pointer when `result_ok` is set is undefined.
4657 pub err: *mut crate::ln::msgs::DecodeError,
4660 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
4661 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::ln::msgs::DecodeError on failure.
4662 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4663 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4664 /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
4665 /// `err` or `result` depending on the state of `result_ok`.
4666 pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
4667 /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
4668 pub result_ok: bool,
4671 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
4672 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4673 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4674 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4675 result: Box::into_raw(Box::new(o)),
4681 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
4682 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4683 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4684 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4685 err: Box::into_raw(Box::new(e)),
4691 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
4692 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
4693 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4694 fn drop(&mut self) {
4696 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4697 let _ = unsafe { Box::from_raw(self.contents.result) };
4700 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4701 let _ = unsafe { Box::from_raw(self.contents.err) };
4706 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4707 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::ln::msgs::DecodeError>) -> Self {
4708 let contents = if o.result_ok {
4709 let result = unsafe { o.contents.result };
4710 unsafe { o.contents.result = std::ptr::null_mut() };
4711 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
4713 let err = unsafe { o.contents.err };
4714 unsafe { o.contents.err = std::ptr::null_mut(); }
4715 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
4719 result_ok: o.result_ok,
4724 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
4725 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4726 /// A pointer to the contents in the success state.
4727 /// Reading from this pointer when `result_ok` is not set is undefined.
4728 pub result: *mut crate::chain::keysinterface::SpendableOutputDescriptor,
4729 /// A pointer to the contents in the error state.
4730 /// Reading from this pointer when `result_ok` is set is undefined.
4731 pub err: *mut crate::ln::msgs::DecodeError,
4734 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4735 /// containing a crate::chain::keysinterface::SpendableOutputDescriptor on success and a crate::ln::msgs::DecodeError on failure.
4736 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4737 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
4738 /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
4739 /// `err` or `result` depending on the state of `result_ok`.
4740 pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
4741 /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
4742 pub result_ok: bool,
4745 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
4746 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4747 CResult_SpendableOutputDescriptorDecodeErrorZ {
4748 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4749 result: Box::into_raw(Box::new(o)),
4755 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
4756 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4757 CResult_SpendableOutputDescriptorDecodeErrorZ {
4758 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4759 err: Box::into_raw(Box::new(e)),
4765 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
4766 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
4767 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
4768 fn drop(&mut self) {
4770 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4771 let _ = unsafe { Box::from_raw(self.contents.result) };
4774 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4775 let _ = unsafe { Box::from_raw(self.contents.err) };
4780 impl From<crate::c_types::CResultTempl<crate::chain::keysinterface::SpendableOutputDescriptor, crate::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
4781 fn from(mut o: crate::c_types::CResultTempl<crate::chain::keysinterface::SpendableOutputDescriptor, crate::ln::msgs::DecodeError>) -> Self {
4782 let contents = if o.result_ok {
4783 let result = unsafe { o.contents.result };
4784 unsafe { o.contents.result = std::ptr::null_mut() };
4785 CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
4787 let err = unsafe { o.contents.err };
4788 unsafe { o.contents.err = std::ptr::null_mut(); }
4789 CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
4793 result_ok: o.result_ok,
4797 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
4798 fn clone(&self) -> Self {
4800 Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4801 result: Box::into_raw(Box::new(<crate::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4804 Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4805 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4811 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
4812 /// but with all dynamically-allocated buffers duplicated in new buffers.
4813 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { orig.clone() }
4815 /// A tuple of 2 elements. See the individual fields for the types contained.
4816 pub struct C2Tuple_SignatureCVec_SignatureZZ {
4817 /// The element at position 0
4818 pub a: crate::c_types::Signature,
4819 /// The element at position 1
4820 pub b: crate::c_types::derived::CVec_SignatureZ,
4822 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
4823 fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
4830 impl C2Tuple_SignatureCVec_SignatureZZ {
4831 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
4835 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
4836 fn clone(&self) -> Self {
4844 /// Creates a new tuple which has the same data as `orig`
4845 /// but with all dynamically-allocated buffers duplicated in new buffers.
4846 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { orig.clone() }
4847 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
4849 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
4850 C2Tuple_SignatureCVec_SignatureZZ { a, b, }
4854 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
4855 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
4857 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
4858 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4859 /// A pointer to the contents in the success state.
4860 /// Reading from this pointer when `result_ok` is not set is undefined.
4861 pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
4862 /// Note that this value is always NULL, as there are no contents in the Err variant
4863 pub err: *mut std::ffi::c_void,
4866 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
4867 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
4868 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4869 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4870 /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
4871 /// `err` or `result` depending on the state of `result_ok`.
4872 pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
4873 /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
4874 pub result_ok: bool,
4877 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
4878 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4879 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4880 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4881 result: Box::into_raw(Box::new(o)),
4887 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
4888 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4889 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4890 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4891 err: std::ptr::null_mut(),
4897 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
4898 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
4899 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4900 fn drop(&mut self) {
4902 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4903 let _ = unsafe { Box::from_raw(self.contents.result) };
4909 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, u8>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4910 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, u8>) -> Self {
4911 let contents = if o.result_ok {
4912 let result = unsafe { o.contents.result };
4913 unsafe { o.contents.result = std::ptr::null_mut() };
4914 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
4916 let _ = unsafe { Box::from_raw(o.contents.err) };
4917 o.contents.err = std::ptr::null_mut();
4918 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: std::ptr::null_mut() }
4922 result_ok: o.result_ok,
4926 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4927 fn clone(&self) -> Self {
4929 Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4930 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
4933 Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4934 err: std::ptr::null_mut()
4940 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
4941 /// but with all dynamically-allocated buffers duplicated in new buffers.
4942 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { orig.clone() }
4944 /// The contents of CResult_SignatureNoneZ
4945 pub union CResult_SignatureNoneZPtr {
4946 /// A pointer to the contents in the success state.
4947 /// Reading from this pointer when `result_ok` is not set is undefined.
4948 pub result: *mut crate::c_types::Signature,
4949 /// Note that this value is always NULL, as there are no contents in the Err variant
4950 pub err: *mut std::ffi::c_void,
4953 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
4954 /// containing a crate::c_types::Signature on success and a () on failure.
4955 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4956 pub struct CResult_SignatureNoneZ {
4957 /// The contents of this CResult_SignatureNoneZ, accessible via either
4958 /// `err` or `result` depending on the state of `result_ok`.
4959 pub contents: CResult_SignatureNoneZPtr,
4960 /// Whether this CResult_SignatureNoneZ represents a success state.
4961 pub result_ok: bool,
4964 /// Creates a new CResult_SignatureNoneZ in the success state.
4965 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
4966 CResult_SignatureNoneZ {
4967 contents: CResult_SignatureNoneZPtr {
4968 result: Box::into_raw(Box::new(o)),
4974 /// Creates a new CResult_SignatureNoneZ in the error state.
4975 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
4976 CResult_SignatureNoneZ {
4977 contents: CResult_SignatureNoneZPtr {
4978 err: std::ptr::null_mut(),
4984 /// Frees any resources used by the CResult_SignatureNoneZ.
4985 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
4986 impl Drop for CResult_SignatureNoneZ {
4987 fn drop(&mut self) {
4989 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4990 let _ = unsafe { Box::from_raw(self.contents.result) };
4996 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, u8>> for CResult_SignatureNoneZ {
4997 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, u8>) -> Self {
4998 let contents = if o.result_ok {
4999 let result = unsafe { o.contents.result };
5000 unsafe { o.contents.result = std::ptr::null_mut() };
5001 CResult_SignatureNoneZPtr { result }
5003 let _ = unsafe { Box::from_raw(o.contents.err) };
5004 o.contents.err = std::ptr::null_mut();
5005 CResult_SignatureNoneZPtr { err: std::ptr::null_mut() }
5009 result_ok: o.result_ok,
5013 impl Clone for CResult_SignatureNoneZ {
5014 fn clone(&self) -> Self {
5016 Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
5017 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
5020 Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
5021 err: std::ptr::null_mut()
5027 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
5028 /// but with all dynamically-allocated buffers duplicated in new buffers.
5029 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { orig.clone() }
5031 /// The contents of CResult_SignDecodeErrorZ
5032 pub union CResult_SignDecodeErrorZPtr {
5033 /// A pointer to the contents in the success state.
5034 /// Reading from this pointer when `result_ok` is not set is undefined.
5035 pub result: *mut crate::chain::keysinterface::Sign,
5036 /// A pointer to the contents in the error state.
5037 /// Reading from this pointer when `result_ok` is set is undefined.
5038 pub err: *mut crate::ln::msgs::DecodeError,
5041 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
5042 /// containing a crate::chain::keysinterface::Sign on success and a crate::ln::msgs::DecodeError on failure.
5043 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5044 pub struct CResult_SignDecodeErrorZ {
5045 /// The contents of this CResult_SignDecodeErrorZ, accessible via either
5046 /// `err` or `result` depending on the state of `result_ok`.
5047 pub contents: CResult_SignDecodeErrorZPtr,
5048 /// Whether this CResult_SignDecodeErrorZ represents a success state.
5049 pub result_ok: bool,
5052 /// Creates a new CResult_SignDecodeErrorZ in the success state.
5053 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
5054 CResult_SignDecodeErrorZ {
5055 contents: CResult_SignDecodeErrorZPtr {
5056 result: Box::into_raw(Box::new(o)),
5062 /// Creates a new CResult_SignDecodeErrorZ in the error state.
5063 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
5064 CResult_SignDecodeErrorZ {
5065 contents: CResult_SignDecodeErrorZPtr {
5066 err: Box::into_raw(Box::new(e)),
5072 /// Frees any resources used by the CResult_SignDecodeErrorZ.
5073 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
5074 impl Drop for CResult_SignDecodeErrorZ {
5075 fn drop(&mut self) {
5077 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5078 let _ = unsafe { Box::from_raw(self.contents.result) };
5081 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5082 let _ = unsafe { Box::from_raw(self.contents.err) };
5087 impl From<crate::c_types::CResultTempl<crate::chain::keysinterface::Sign, crate::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
5088 fn from(mut o: crate::c_types::CResultTempl<crate::chain::keysinterface::Sign, crate::ln::msgs::DecodeError>) -> Self {
5089 let contents = if o.result_ok {
5090 let result = unsafe { o.contents.result };
5091 unsafe { o.contents.result = std::ptr::null_mut() };
5092 CResult_SignDecodeErrorZPtr { result }
5094 let err = unsafe { o.contents.err };
5095 unsafe { o.contents.err = std::ptr::null_mut(); }
5096 CResult_SignDecodeErrorZPtr { err }
5100 result_ok: o.result_ok,
5104 impl Clone for CResult_SignDecodeErrorZ {
5105 fn clone(&self) -> Self {
5107 Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
5108 result: Box::into_raw(Box::new(<crate::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
5111 Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
5112 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5118 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
5119 /// but with all dynamically-allocated buffers duplicated in new buffers.
5120 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { orig.clone() }
5122 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
5123 /// This corresponds to std::vector in C++
5124 pub struct CVec_CVec_u8ZZ {
5125 /// The elements in the array.
5126 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5127 pub data: *mut crate::c_types::derived::CVec_u8Z,
5128 /// The number of elements pointed to by `data`.
5131 impl CVec_CVec_u8ZZ {
5132 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
5133 if self.datalen == 0 { return Vec::new(); }
5134 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5135 self.data = std::ptr::null_mut();
5139 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
5140 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5143 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
5144 fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
5145 let datalen = v.len();
5146 let data = Box::into_raw(v.into_boxed_slice());
5147 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5151 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5152 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
5153 impl Drop for CVec_CVec_u8ZZ {
5154 fn drop(&mut self) {
5155 if self.datalen == 0 { return; }
5156 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5159 impl Clone for CVec_CVec_u8ZZ {
5160 fn clone(&self) -> Self {
5161 let mut res = Vec::new();
5162 if self.datalen == 0 { return Self::from(res); }
5163 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5168 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
5169 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
5170 /// A pointer to the contents in the success state.
5171 /// Reading from this pointer when `result_ok` is not set is undefined.
5172 pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
5173 /// Note that this value is always NULL, as there are no contents in the Err variant
5174 pub err: *mut std::ffi::c_void,
5177 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
5178 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
5179 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5180 pub struct CResult_CVec_CVec_u8ZZNoneZ {
5181 /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
5182 /// `err` or `result` depending on the state of `result_ok`.
5183 pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
5184 /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
5185 pub result_ok: bool,
5188 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
5189 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
5190 CResult_CVec_CVec_u8ZZNoneZ {
5191 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5192 result: Box::into_raw(Box::new(o)),
5198 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
5199 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
5200 CResult_CVec_CVec_u8ZZNoneZ {
5201 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5202 err: std::ptr::null_mut(),
5208 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
5209 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
5210 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
5211 fn drop(&mut self) {
5213 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5214 let _ = unsafe { Box::from_raw(self.contents.result) };
5220 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, u8>> for CResult_CVec_CVec_u8ZZNoneZ {
5221 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, u8>) -> Self {
5222 let contents = if o.result_ok {
5223 let result = unsafe { o.contents.result };
5224 unsafe { o.contents.result = std::ptr::null_mut() };
5225 CResult_CVec_CVec_u8ZZNoneZPtr { result }
5227 let _ = unsafe { Box::from_raw(o.contents.err) };
5228 o.contents.err = std::ptr::null_mut();
5229 CResult_CVec_CVec_u8ZZNoneZPtr { err: std::ptr::null_mut() }
5233 result_ok: o.result_ok,
5237 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
5238 fn clone(&self) -> Self {
5240 Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5241 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
5244 Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5245 err: std::ptr::null_mut()
5251 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
5252 /// but with all dynamically-allocated buffers duplicated in new buffers.
5253 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { orig.clone() }
5255 /// The contents of CResult_InMemorySignerDecodeErrorZ
5256 pub union CResult_InMemorySignerDecodeErrorZPtr {
5257 /// A pointer to the contents in the success state.
5258 /// Reading from this pointer when `result_ok` is not set is undefined.
5259 pub result: *mut crate::chain::keysinterface::InMemorySigner,
5260 /// A pointer to the contents in the error state.
5261 /// Reading from this pointer when `result_ok` is set is undefined.
5262 pub err: *mut crate::ln::msgs::DecodeError,
5265 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
5266 /// containing a crate::chain::keysinterface::InMemorySigner on success and a crate::ln::msgs::DecodeError on failure.
5267 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5268 pub struct CResult_InMemorySignerDecodeErrorZ {
5269 /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
5270 /// `err` or `result` depending on the state of `result_ok`.
5271 pub contents: CResult_InMemorySignerDecodeErrorZPtr,
5272 /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
5273 pub result_ok: bool,
5276 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
5277 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
5278 CResult_InMemorySignerDecodeErrorZ {
5279 contents: CResult_InMemorySignerDecodeErrorZPtr {
5280 result: Box::into_raw(Box::new(o)),
5286 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
5287 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
5288 CResult_InMemorySignerDecodeErrorZ {
5289 contents: CResult_InMemorySignerDecodeErrorZPtr {
5290 err: Box::into_raw(Box::new(e)),
5296 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
5297 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
5298 impl Drop for CResult_InMemorySignerDecodeErrorZ {
5299 fn drop(&mut self) {
5301 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5302 let _ = unsafe { Box::from_raw(self.contents.result) };
5305 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5306 let _ = unsafe { Box::from_raw(self.contents.err) };
5311 impl From<crate::c_types::CResultTempl<crate::chain::keysinterface::InMemorySigner, crate::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
5312 fn from(mut o: crate::c_types::CResultTempl<crate::chain::keysinterface::InMemorySigner, crate::ln::msgs::DecodeError>) -> Self {
5313 let contents = if o.result_ok {
5314 let result = unsafe { o.contents.result };
5315 unsafe { o.contents.result = std::ptr::null_mut() };
5316 CResult_InMemorySignerDecodeErrorZPtr { result }
5318 let err = unsafe { o.contents.err };
5319 unsafe { o.contents.err = std::ptr::null_mut(); }
5320 CResult_InMemorySignerDecodeErrorZPtr { err }
5324 result_ok: o.result_ok,
5328 impl Clone for CResult_InMemorySignerDecodeErrorZ {
5329 fn clone(&self) -> Self {
5331 Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
5332 result: Box::into_raw(Box::new(<crate::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
5335 Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
5336 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5342 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
5343 /// but with all dynamically-allocated buffers duplicated in new buffers.
5344 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { orig.clone() }
5346 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
5347 /// This corresponds to std::vector in C++
5348 pub struct CVec_TxOutZ {
5349 /// The elements in the array.
5350 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5351 pub data: *mut crate::c_types::TxOut,
5352 /// The number of elements pointed to by `data`.
5356 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
5357 if self.datalen == 0 { return Vec::new(); }
5358 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5359 self.data = std::ptr::null_mut();
5363 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
5364 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5367 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
5368 fn from(v: Vec<crate::c_types::TxOut>) -> Self {
5369 let datalen = v.len();
5370 let data = Box::into_raw(v.into_boxed_slice());
5371 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5375 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5376 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
5377 impl Drop for CVec_TxOutZ {
5378 fn drop(&mut self) {
5379 if self.datalen == 0 { return; }
5380 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5383 impl Clone for CVec_TxOutZ {
5384 fn clone(&self) -> Self {
5385 let mut res = Vec::new();
5386 if self.datalen == 0 { return Self::from(res); }
5387 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5392 /// The contents of CResult_TransactionNoneZ
5393 pub union CResult_TransactionNoneZPtr {
5394 /// A pointer to the contents in the success state.
5395 /// Reading from this pointer when `result_ok` is not set is undefined.
5396 pub result: *mut crate::c_types::Transaction,
5397 /// Note that this value is always NULL, as there are no contents in the Err variant
5398 pub err: *mut std::ffi::c_void,
5401 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
5402 /// containing a crate::c_types::Transaction on success and a () on failure.
5403 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5404 pub struct CResult_TransactionNoneZ {
5405 /// The contents of this CResult_TransactionNoneZ, accessible via either
5406 /// `err` or `result` depending on the state of `result_ok`.
5407 pub contents: CResult_TransactionNoneZPtr,
5408 /// Whether this CResult_TransactionNoneZ represents a success state.
5409 pub result_ok: bool,
5412 /// Creates a new CResult_TransactionNoneZ in the success state.
5413 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
5414 CResult_TransactionNoneZ {
5415 contents: CResult_TransactionNoneZPtr {
5416 result: Box::into_raw(Box::new(o)),
5422 /// Creates a new CResult_TransactionNoneZ in the error state.
5423 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
5424 CResult_TransactionNoneZ {
5425 contents: CResult_TransactionNoneZPtr {
5426 err: std::ptr::null_mut(),
5432 /// Frees any resources used by the CResult_TransactionNoneZ.
5433 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
5434 impl Drop for CResult_TransactionNoneZ {
5435 fn drop(&mut self) {
5437 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5438 let _ = unsafe { Box::from_raw(self.contents.result) };
5444 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, u8>> for CResult_TransactionNoneZ {
5445 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, u8>) -> Self {
5446 let contents = if o.result_ok {
5447 let result = unsafe { o.contents.result };
5448 unsafe { o.contents.result = std::ptr::null_mut() };
5449 CResult_TransactionNoneZPtr { result }
5451 let _ = unsafe { Box::from_raw(o.contents.err) };
5452 o.contents.err = std::ptr::null_mut();
5453 CResult_TransactionNoneZPtr { err: std::ptr::null_mut() }
5457 result_ok: o.result_ok,
5462 /// A dynamically-allocated array of crate::routing::router::RouteHops of arbitrary size.
5463 /// This corresponds to std::vector in C++
5464 pub struct CVec_RouteHopZ {
5465 /// The elements in the array.
5466 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5467 pub data: *mut crate::routing::router::RouteHop,
5468 /// The number of elements pointed to by `data`.
5471 impl CVec_RouteHopZ {
5472 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::routing::router::RouteHop> {
5473 if self.datalen == 0 { return Vec::new(); }
5474 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5475 self.data = std::ptr::null_mut();
5479 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::routing::router::RouteHop] {
5480 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5483 impl From<Vec<crate::routing::router::RouteHop>> for CVec_RouteHopZ {
5484 fn from(v: Vec<crate::routing::router::RouteHop>) -> Self {
5485 let datalen = v.len();
5486 let data = Box::into_raw(v.into_boxed_slice());
5487 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5491 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5492 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
5493 impl Drop for CVec_RouteHopZ {
5494 fn drop(&mut self) {
5495 if self.datalen == 0 { return; }
5496 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5499 impl Clone for CVec_RouteHopZ {
5500 fn clone(&self) -> Self {
5501 let mut res = Vec::new();
5502 if self.datalen == 0 { return Self::from(res); }
5503 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5508 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
5509 /// This corresponds to std::vector in C++
5510 pub struct CVec_CVec_RouteHopZZ {
5511 /// The elements in the array.
5512 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5513 pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
5514 /// The number of elements pointed to by `data`.
5517 impl CVec_CVec_RouteHopZZ {
5518 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
5519 if self.datalen == 0 { return Vec::new(); }
5520 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5521 self.data = std::ptr::null_mut();
5525 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
5526 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5529 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
5530 fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
5531 let datalen = v.len();
5532 let data = Box::into_raw(v.into_boxed_slice());
5533 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5537 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5538 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
5539 impl Drop for CVec_CVec_RouteHopZZ {
5540 fn drop(&mut self) {
5541 if self.datalen == 0 { return; }
5542 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5545 impl Clone for CVec_CVec_RouteHopZZ {
5546 fn clone(&self) -> Self {
5547 let mut res = Vec::new();
5548 if self.datalen == 0 { return Self::from(res); }
5549 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5554 /// The contents of CResult_RouteDecodeErrorZ
5555 pub union CResult_RouteDecodeErrorZPtr {
5556 /// A pointer to the contents in the success state.
5557 /// Reading from this pointer when `result_ok` is not set is undefined.
5558 pub result: *mut crate::routing::router::Route,
5559 /// A pointer to the contents in the error state.
5560 /// Reading from this pointer when `result_ok` is set is undefined.
5561 pub err: *mut crate::ln::msgs::DecodeError,
5564 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
5565 /// containing a crate::routing::router::Route on success and a crate::ln::msgs::DecodeError on failure.
5566 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5567 pub struct CResult_RouteDecodeErrorZ {
5568 /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
5569 /// `err` or `result` depending on the state of `result_ok`.
5570 pub contents: CResult_RouteDecodeErrorZPtr,
5571 /// Whether this CResult_RouteDecodeErrorZ represents a success state.
5572 pub result_ok: bool,
5575 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
5576 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::routing::router::Route) -> CResult_RouteDecodeErrorZ {
5577 CResult_RouteDecodeErrorZ {
5578 contents: CResult_RouteDecodeErrorZPtr {
5579 result: Box::into_raw(Box::new(o)),
5585 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
5586 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
5587 CResult_RouteDecodeErrorZ {
5588 contents: CResult_RouteDecodeErrorZPtr {
5589 err: Box::into_raw(Box::new(e)),
5595 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
5596 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
5597 impl Drop for CResult_RouteDecodeErrorZ {
5598 fn drop(&mut self) {
5600 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5601 let _ = unsafe { Box::from_raw(self.contents.result) };
5604 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5605 let _ = unsafe { Box::from_raw(self.contents.err) };
5610 impl From<crate::c_types::CResultTempl<crate::routing::router::Route, crate::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
5611 fn from(mut o: crate::c_types::CResultTempl<crate::routing::router::Route, crate::ln::msgs::DecodeError>) -> Self {
5612 let contents = if o.result_ok {
5613 let result = unsafe { o.contents.result };
5614 unsafe { o.contents.result = std::ptr::null_mut() };
5615 CResult_RouteDecodeErrorZPtr { result }
5617 let err = unsafe { o.contents.err };
5618 unsafe { o.contents.err = std::ptr::null_mut(); }
5619 CResult_RouteDecodeErrorZPtr { err }
5623 result_ok: o.result_ok,
5627 impl Clone for CResult_RouteDecodeErrorZ {
5628 fn clone(&self) -> Self {
5630 Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
5631 result: Box::into_raw(Box::new(<crate::routing::router::Route>::clone(unsafe { &*self.contents.result })))
5634 Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
5635 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5641 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
5642 /// but with all dynamically-allocated buffers duplicated in new buffers.
5643 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { orig.clone() }
5645 /// A dynamically-allocated array of crate::routing::router::RouteHints of arbitrary size.
5646 /// This corresponds to std::vector in C++
5647 pub struct CVec_RouteHintZ {
5648 /// The elements in the array.
5649 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5650 pub data: *mut crate::routing::router::RouteHint,
5651 /// The number of elements pointed to by `data`.
5654 impl CVec_RouteHintZ {
5655 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::routing::router::RouteHint> {
5656 if self.datalen == 0 { return Vec::new(); }
5657 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5658 self.data = std::ptr::null_mut();
5662 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::routing::router::RouteHint] {
5663 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5666 impl From<Vec<crate::routing::router::RouteHint>> for CVec_RouteHintZ {
5667 fn from(v: Vec<crate::routing::router::RouteHint>) -> Self {
5668 let datalen = v.len();
5669 let data = Box::into_raw(v.into_boxed_slice());
5670 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5674 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5675 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
5676 impl Drop for CVec_RouteHintZ {
5677 fn drop(&mut self) {
5678 if self.datalen == 0 { return; }
5679 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5682 impl Clone for CVec_RouteHintZ {
5683 fn clone(&self) -> Self {
5684 let mut res = Vec::new();
5685 if self.datalen == 0 { return Self::from(res); }
5686 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5691 /// The contents of CResult_RouteLightningErrorZ
5692 pub union CResult_RouteLightningErrorZPtr {
5693 /// A pointer to the contents in the success state.
5694 /// Reading from this pointer when `result_ok` is not set is undefined.
5695 pub result: *mut crate::routing::router::Route,
5696 /// A pointer to the contents in the error state.
5697 /// Reading from this pointer when `result_ok` is set is undefined.
5698 pub err: *mut crate::ln::msgs::LightningError,
5701 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
5702 /// containing a crate::routing::router::Route on success and a crate::ln::msgs::LightningError on failure.
5703 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5704 pub struct CResult_RouteLightningErrorZ {
5705 /// The contents of this CResult_RouteLightningErrorZ, accessible via either
5706 /// `err` or `result` depending on the state of `result_ok`.
5707 pub contents: CResult_RouteLightningErrorZPtr,
5708 /// Whether this CResult_RouteLightningErrorZ represents a success state.
5709 pub result_ok: bool,
5712 /// Creates a new CResult_RouteLightningErrorZ in the success state.
5713 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::routing::router::Route) -> CResult_RouteLightningErrorZ {
5714 CResult_RouteLightningErrorZ {
5715 contents: CResult_RouteLightningErrorZPtr {
5716 result: Box::into_raw(Box::new(o)),
5722 /// Creates a new CResult_RouteLightningErrorZ in the error state.
5723 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
5724 CResult_RouteLightningErrorZ {
5725 contents: CResult_RouteLightningErrorZPtr {
5726 err: Box::into_raw(Box::new(e)),
5732 /// Frees any resources used by the CResult_RouteLightningErrorZ.
5733 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
5734 impl Drop for CResult_RouteLightningErrorZ {
5735 fn drop(&mut self) {
5737 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5738 let _ = unsafe { Box::from_raw(self.contents.result) };
5741 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5742 let _ = unsafe { Box::from_raw(self.contents.err) };
5747 impl From<crate::c_types::CResultTempl<crate::routing::router::Route, crate::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
5748 fn from(mut o: crate::c_types::CResultTempl<crate::routing::router::Route, crate::ln::msgs::LightningError>) -> Self {
5749 let contents = if o.result_ok {
5750 let result = unsafe { o.contents.result };
5751 unsafe { o.contents.result = std::ptr::null_mut() };
5752 CResult_RouteLightningErrorZPtr { result }
5754 let err = unsafe { o.contents.err };
5755 unsafe { o.contents.err = std::ptr::null_mut(); }
5756 CResult_RouteLightningErrorZPtr { err }
5760 result_ok: o.result_ok,
5764 impl Clone for CResult_RouteLightningErrorZ {
5765 fn clone(&self) -> Self {
5767 Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
5768 result: Box::into_raw(Box::new(<crate::routing::router::Route>::clone(unsafe { &*self.contents.result })))
5771 Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
5772 err: Box::into_raw(Box::new(<crate::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
5778 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
5779 /// but with all dynamically-allocated buffers duplicated in new buffers.
5780 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { orig.clone() }
5782 /// The contents of CResult_NetAddressu8Z
5783 pub union CResult_NetAddressu8ZPtr {
5784 /// A pointer to the contents in the success state.
5785 /// Reading from this pointer when `result_ok` is not set is undefined.
5786 pub result: *mut crate::ln::msgs::NetAddress,
5787 /// A pointer to the contents in the error state.
5788 /// Reading from this pointer when `result_ok` is set is undefined.
5792 /// A CResult_NetAddressu8Z represents the result of a fallible operation,
5793 /// containing a crate::ln::msgs::NetAddress on success and a u8 on failure.
5794 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5795 pub struct CResult_NetAddressu8Z {
5796 /// The contents of this CResult_NetAddressu8Z, accessible via either
5797 /// `err` or `result` depending on the state of `result_ok`.
5798 pub contents: CResult_NetAddressu8ZPtr,
5799 /// Whether this CResult_NetAddressu8Z represents a success state.
5800 pub result_ok: bool,
5803 /// Creates a new CResult_NetAddressu8Z in the success state.
5804 pub extern "C" fn CResult_NetAddressu8Z_ok(o: crate::ln::msgs::NetAddress) -> CResult_NetAddressu8Z {
5805 CResult_NetAddressu8Z {
5806 contents: CResult_NetAddressu8ZPtr {
5807 result: Box::into_raw(Box::new(o)),
5813 /// Creates a new CResult_NetAddressu8Z in the error state.
5814 pub extern "C" fn CResult_NetAddressu8Z_err(e: u8) -> CResult_NetAddressu8Z {
5815 CResult_NetAddressu8Z {
5816 contents: CResult_NetAddressu8ZPtr {
5817 err: Box::into_raw(Box::new(e)),
5823 /// Frees any resources used by the CResult_NetAddressu8Z.
5824 pub extern "C" fn CResult_NetAddressu8Z_free(_res: CResult_NetAddressu8Z) { }
5825 impl Drop for CResult_NetAddressu8Z {
5826 fn drop(&mut self) {
5828 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5829 let _ = unsafe { Box::from_raw(self.contents.result) };
5832 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5833 let _ = unsafe { Box::from_raw(self.contents.err) };
5838 impl From<crate::c_types::CResultTempl<crate::ln::msgs::NetAddress, u8>> for CResult_NetAddressu8Z {
5839 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::NetAddress, u8>) -> Self {
5840 let contents = if o.result_ok {
5841 let result = unsafe { o.contents.result };
5842 unsafe { o.contents.result = std::ptr::null_mut() };
5843 CResult_NetAddressu8ZPtr { result }
5845 let err = unsafe { o.contents.err };
5846 unsafe { o.contents.err = std::ptr::null_mut(); }
5847 CResult_NetAddressu8ZPtr { err }
5851 result_ok: o.result_ok,
5855 impl Clone for CResult_NetAddressu8Z {
5856 fn clone(&self) -> Self {
5858 Self { result_ok: true, contents: CResult_NetAddressu8ZPtr {
5859 result: Box::into_raw(Box::new(<crate::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
5862 Self { result_ok: false, contents: CResult_NetAddressu8ZPtr {
5863 err: Box::into_raw(Box::new(<u8>::clone(unsafe { &*self.contents.err })))
5869 /// Creates a new CResult_NetAddressu8Z which has the same data as `orig`
5870 /// but with all dynamically-allocated buffers duplicated in new buffers.
5871 pub extern "C" fn CResult_NetAddressu8Z_clone(orig: &CResult_NetAddressu8Z) -> CResult_NetAddressu8Z { orig.clone() }
5873 /// The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
5874 pub union CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5875 /// A pointer to the contents in the success state.
5876 /// Reading from this pointer when `result_ok` is not set is undefined.
5877 pub result: *mut crate::c_types::derived::CResult_NetAddressu8Z,
5878 /// A pointer to the contents in the error state.
5879 /// Reading from this pointer when `result_ok` is set is undefined.
5880 pub err: *mut crate::ln::msgs::DecodeError,
5883 /// A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
5884 /// containing a crate::c_types::derived::CResult_NetAddressu8Z on success and a crate::ln::msgs::DecodeError on failure.
5885 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5886 pub struct CResult_CResult_NetAddressu8ZDecodeErrorZ {
5887 /// The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
5888 /// `err` or `result` depending on the state of `result_ok`.
5889 pub contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr,
5890 /// Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
5891 pub result_ok: bool,
5894 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
5895 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o: crate::c_types::derived::CResult_NetAddressu8Z) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
5896 CResult_CResult_NetAddressu8ZDecodeErrorZ {
5897 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5898 result: Box::into_raw(Box::new(o)),
5904 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
5905 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
5906 CResult_CResult_NetAddressu8ZDecodeErrorZ {
5907 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5908 err: Box::into_raw(Box::new(e)),
5914 /// Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
5915 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res: CResult_CResult_NetAddressu8ZDecodeErrorZ) { }
5916 impl Drop for CResult_CResult_NetAddressu8ZDecodeErrorZ {
5917 fn drop(&mut self) {
5919 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5920 let _ = unsafe { Box::from_raw(self.contents.result) };
5923 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5924 let _ = unsafe { Box::from_raw(self.contents.err) };
5929 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::ln::msgs::DecodeError>> for CResult_CResult_NetAddressu8ZDecodeErrorZ {
5930 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::ln::msgs::DecodeError>) -> Self {
5931 let contents = if o.result_ok {
5932 let result = unsafe { o.contents.result };
5933 unsafe { o.contents.result = std::ptr::null_mut() };
5934 CResult_CResult_NetAddressu8ZDecodeErrorZPtr { result }
5936 let err = unsafe { o.contents.err };
5937 unsafe { o.contents.err = std::ptr::null_mut(); }
5938 CResult_CResult_NetAddressu8ZDecodeErrorZPtr { err }
5942 result_ok: o.result_ok,
5946 impl Clone for CResult_CResult_NetAddressu8ZDecodeErrorZ {
5947 fn clone(&self) -> Self {
5949 Self { result_ok: true, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5950 result: Box::into_raw(Box::new(<crate::c_types::derived::CResult_NetAddressu8Z>::clone(unsafe { &*self.contents.result })))
5953 Self { result_ok: false, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5954 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5960 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
5961 /// but with all dynamically-allocated buffers duplicated in new buffers.
5962 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig: &CResult_CResult_NetAddressu8ZDecodeErrorZ) -> CResult_CResult_NetAddressu8ZDecodeErrorZ { orig.clone() }
5964 /// A dynamically-allocated array of crate::ln::msgs::UpdateAddHTLCs of arbitrary size.
5965 /// This corresponds to std::vector in C++
5966 pub struct CVec_UpdateAddHTLCZ {
5967 /// The elements in the array.
5968 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5969 pub data: *mut crate::ln::msgs::UpdateAddHTLC,
5970 /// The number of elements pointed to by `data`.
5973 impl CVec_UpdateAddHTLCZ {
5974 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::UpdateAddHTLC> {
5975 if self.datalen == 0 { return Vec::new(); }
5976 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5977 self.data = std::ptr::null_mut();
5981 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::UpdateAddHTLC] {
5982 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5985 impl From<Vec<crate::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
5986 fn from(v: Vec<crate::ln::msgs::UpdateAddHTLC>) -> Self {
5987 let datalen = v.len();
5988 let data = Box::into_raw(v.into_boxed_slice());
5989 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5993 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5994 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
5995 impl Drop for CVec_UpdateAddHTLCZ {
5996 fn drop(&mut self) {
5997 if self.datalen == 0 { return; }
5998 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6001 impl Clone for CVec_UpdateAddHTLCZ {
6002 fn clone(&self) -> Self {
6003 let mut res = Vec::new();
6004 if self.datalen == 0 { return Self::from(res); }
6005 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6010 /// A dynamically-allocated array of crate::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
6011 /// This corresponds to std::vector in C++
6012 pub struct CVec_UpdateFulfillHTLCZ {
6013 /// The elements in the array.
6014 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6015 pub data: *mut crate::ln::msgs::UpdateFulfillHTLC,
6016 /// The number of elements pointed to by `data`.
6019 impl CVec_UpdateFulfillHTLCZ {
6020 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::UpdateFulfillHTLC> {
6021 if self.datalen == 0 { return Vec::new(); }
6022 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6023 self.data = std::ptr::null_mut();
6027 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::UpdateFulfillHTLC] {
6028 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6031 impl From<Vec<crate::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
6032 fn from(v: Vec<crate::ln::msgs::UpdateFulfillHTLC>) -> Self {
6033 let datalen = v.len();
6034 let data = Box::into_raw(v.into_boxed_slice());
6035 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6039 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6040 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
6041 impl Drop for CVec_UpdateFulfillHTLCZ {
6042 fn drop(&mut self) {
6043 if self.datalen == 0 { return; }
6044 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6047 impl Clone for CVec_UpdateFulfillHTLCZ {
6048 fn clone(&self) -> Self {
6049 let mut res = Vec::new();
6050 if self.datalen == 0 { return Self::from(res); }
6051 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6056 /// A dynamically-allocated array of crate::ln::msgs::UpdateFailHTLCs of arbitrary size.
6057 /// This corresponds to std::vector in C++
6058 pub struct CVec_UpdateFailHTLCZ {
6059 /// The elements in the array.
6060 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6061 pub data: *mut crate::ln::msgs::UpdateFailHTLC,
6062 /// The number of elements pointed to by `data`.
6065 impl CVec_UpdateFailHTLCZ {
6066 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::UpdateFailHTLC> {
6067 if self.datalen == 0 { return Vec::new(); }
6068 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6069 self.data = std::ptr::null_mut();
6073 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::UpdateFailHTLC] {
6074 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6077 impl From<Vec<crate::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
6078 fn from(v: Vec<crate::ln::msgs::UpdateFailHTLC>) -> Self {
6079 let datalen = v.len();
6080 let data = Box::into_raw(v.into_boxed_slice());
6081 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6085 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6086 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
6087 impl Drop for CVec_UpdateFailHTLCZ {
6088 fn drop(&mut self) {
6089 if self.datalen == 0 { return; }
6090 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6093 impl Clone for CVec_UpdateFailHTLCZ {
6094 fn clone(&self) -> Self {
6095 let mut res = Vec::new();
6096 if self.datalen == 0 { return Self::from(res); }
6097 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6102 /// A dynamically-allocated array of crate::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
6103 /// This corresponds to std::vector in C++
6104 pub struct CVec_UpdateFailMalformedHTLCZ {
6105 /// The elements in the array.
6106 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6107 pub data: *mut crate::ln::msgs::UpdateFailMalformedHTLC,
6108 /// The number of elements pointed to by `data`.
6111 impl CVec_UpdateFailMalformedHTLCZ {
6112 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::UpdateFailMalformedHTLC> {
6113 if self.datalen == 0 { return Vec::new(); }
6114 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6115 self.data = std::ptr::null_mut();
6119 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::UpdateFailMalformedHTLC] {
6120 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6123 impl From<Vec<crate::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
6124 fn from(v: Vec<crate::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
6125 let datalen = v.len();
6126 let data = Box::into_raw(v.into_boxed_slice());
6127 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6131 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6132 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
6133 impl Drop for CVec_UpdateFailMalformedHTLCZ {
6134 fn drop(&mut self) {
6135 if self.datalen == 0 { return; }
6136 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6139 impl Clone for CVec_UpdateFailMalformedHTLCZ {
6140 fn clone(&self) -> Self {
6141 let mut res = Vec::new();
6142 if self.datalen == 0 { return Self::from(res); }
6143 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6148 /// The contents of CResult_AcceptChannelDecodeErrorZ
6149 pub union CResult_AcceptChannelDecodeErrorZPtr {
6150 /// A pointer to the contents in the success state.
6151 /// Reading from this pointer when `result_ok` is not set is undefined.
6152 pub result: *mut crate::ln::msgs::AcceptChannel,
6153 /// A pointer to the contents in the error state.
6154 /// Reading from this pointer when `result_ok` is set is undefined.
6155 pub err: *mut crate::ln::msgs::DecodeError,
6158 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
6159 /// containing a crate::ln::msgs::AcceptChannel on success and a crate::ln::msgs::DecodeError on failure.
6160 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6161 pub struct CResult_AcceptChannelDecodeErrorZ {
6162 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
6163 /// `err` or `result` depending on the state of `result_ok`.
6164 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
6165 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
6166 pub result_ok: bool,
6169 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
6170 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
6171 CResult_AcceptChannelDecodeErrorZ {
6172 contents: CResult_AcceptChannelDecodeErrorZPtr {
6173 result: Box::into_raw(Box::new(o)),
6179 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
6180 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
6181 CResult_AcceptChannelDecodeErrorZ {
6182 contents: CResult_AcceptChannelDecodeErrorZPtr {
6183 err: Box::into_raw(Box::new(e)),
6189 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
6190 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
6191 impl Drop for CResult_AcceptChannelDecodeErrorZ {
6192 fn drop(&mut self) {
6194 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6195 let _ = unsafe { Box::from_raw(self.contents.result) };
6198 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6199 let _ = unsafe { Box::from_raw(self.contents.err) };
6204 impl From<crate::c_types::CResultTempl<crate::ln::msgs::AcceptChannel, crate::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
6205 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::AcceptChannel, crate::ln::msgs::DecodeError>) -> Self {
6206 let contents = if o.result_ok {
6207 let result = unsafe { o.contents.result };
6208 unsafe { o.contents.result = std::ptr::null_mut() };
6209 CResult_AcceptChannelDecodeErrorZPtr { result }
6211 let err = unsafe { o.contents.err };
6212 unsafe { o.contents.err = std::ptr::null_mut(); }
6213 CResult_AcceptChannelDecodeErrorZPtr { err }
6217 result_ok: o.result_ok,
6221 impl Clone for CResult_AcceptChannelDecodeErrorZ {
6222 fn clone(&self) -> Self {
6224 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
6225 result: Box::into_raw(Box::new(<crate::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
6228 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
6229 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6235 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
6236 /// but with all dynamically-allocated buffers duplicated in new buffers.
6237 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { orig.clone() }
6239 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
6240 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
6241 /// A pointer to the contents in the success state.
6242 /// Reading from this pointer when `result_ok` is not set is undefined.
6243 pub result: *mut crate::ln::msgs::AnnouncementSignatures,
6244 /// A pointer to the contents in the error state.
6245 /// Reading from this pointer when `result_ok` is set is undefined.
6246 pub err: *mut crate::ln::msgs::DecodeError,
6249 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
6250 /// containing a crate::ln::msgs::AnnouncementSignatures on success and a crate::ln::msgs::DecodeError on failure.
6251 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6252 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
6253 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
6254 /// `err` or `result` depending on the state of `result_ok`.
6255 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
6256 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
6257 pub result_ok: bool,
6260 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
6261 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
6262 CResult_AnnouncementSignaturesDecodeErrorZ {
6263 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
6264 result: Box::into_raw(Box::new(o)),
6270 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
6271 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
6272 CResult_AnnouncementSignaturesDecodeErrorZ {
6273 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
6274 err: Box::into_raw(Box::new(e)),
6280 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
6281 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
6282 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
6283 fn drop(&mut self) {
6285 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6286 let _ = unsafe { Box::from_raw(self.contents.result) };
6289 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6290 let _ = unsafe { Box::from_raw(self.contents.err) };
6295 impl From<crate::c_types::CResultTempl<crate::ln::msgs::AnnouncementSignatures, crate::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
6296 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::AnnouncementSignatures, crate::ln::msgs::DecodeError>) -> Self {
6297 let contents = if o.result_ok {
6298 let result = unsafe { o.contents.result };
6299 unsafe { o.contents.result = std::ptr::null_mut() };
6300 CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
6302 let err = unsafe { o.contents.err };
6303 unsafe { o.contents.err = std::ptr::null_mut(); }
6304 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
6308 result_ok: o.result_ok,
6312 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
6313 fn clone(&self) -> Self {
6315 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
6316 result: Box::into_raw(Box::new(<crate::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
6319 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
6320 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6326 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
6327 /// but with all dynamically-allocated buffers duplicated in new buffers.
6328 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { orig.clone() }
6330 /// The contents of CResult_ChannelReestablishDecodeErrorZ
6331 pub union CResult_ChannelReestablishDecodeErrorZPtr {
6332 /// A pointer to the contents in the success state.
6333 /// Reading from this pointer when `result_ok` is not set is undefined.
6334 pub result: *mut crate::ln::msgs::ChannelReestablish,
6335 /// A pointer to the contents in the error state.
6336 /// Reading from this pointer when `result_ok` is set is undefined.
6337 pub err: *mut crate::ln::msgs::DecodeError,
6340 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
6341 /// containing a crate::ln::msgs::ChannelReestablish on success and a crate::ln::msgs::DecodeError on failure.
6342 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6343 pub struct CResult_ChannelReestablishDecodeErrorZ {
6344 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
6345 /// `err` or `result` depending on the state of `result_ok`.
6346 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
6347 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
6348 pub result_ok: bool,
6351 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
6352 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
6353 CResult_ChannelReestablishDecodeErrorZ {
6354 contents: CResult_ChannelReestablishDecodeErrorZPtr {
6355 result: Box::into_raw(Box::new(o)),
6361 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
6362 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
6363 CResult_ChannelReestablishDecodeErrorZ {
6364 contents: CResult_ChannelReestablishDecodeErrorZPtr {
6365 err: Box::into_raw(Box::new(e)),
6371 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
6372 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
6373 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
6374 fn drop(&mut self) {
6376 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6377 let _ = unsafe { Box::from_raw(self.contents.result) };
6380 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6381 let _ = unsafe { Box::from_raw(self.contents.err) };
6386 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ChannelReestablish, crate::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
6387 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ChannelReestablish, crate::ln::msgs::DecodeError>) -> Self {
6388 let contents = if o.result_ok {
6389 let result = unsafe { o.contents.result };
6390 unsafe { o.contents.result = std::ptr::null_mut() };
6391 CResult_ChannelReestablishDecodeErrorZPtr { result }
6393 let err = unsafe { o.contents.err };
6394 unsafe { o.contents.err = std::ptr::null_mut(); }
6395 CResult_ChannelReestablishDecodeErrorZPtr { err }
6399 result_ok: o.result_ok,
6403 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
6404 fn clone(&self) -> Self {
6406 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
6407 result: Box::into_raw(Box::new(<crate::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
6410 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
6411 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6417 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
6418 /// but with all dynamically-allocated buffers duplicated in new buffers.
6419 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { orig.clone() }
6421 /// The contents of CResult_ClosingSignedDecodeErrorZ
6422 pub union CResult_ClosingSignedDecodeErrorZPtr {
6423 /// A pointer to the contents in the success state.
6424 /// Reading from this pointer when `result_ok` is not set is undefined.
6425 pub result: *mut crate::ln::msgs::ClosingSigned,
6426 /// A pointer to the contents in the error state.
6427 /// Reading from this pointer when `result_ok` is set is undefined.
6428 pub err: *mut crate::ln::msgs::DecodeError,
6431 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
6432 /// containing a crate::ln::msgs::ClosingSigned on success and a crate::ln::msgs::DecodeError on failure.
6433 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6434 pub struct CResult_ClosingSignedDecodeErrorZ {
6435 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
6436 /// `err` or `result` depending on the state of `result_ok`.
6437 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
6438 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
6439 pub result_ok: bool,
6442 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
6443 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
6444 CResult_ClosingSignedDecodeErrorZ {
6445 contents: CResult_ClosingSignedDecodeErrorZPtr {
6446 result: Box::into_raw(Box::new(o)),
6452 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
6453 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
6454 CResult_ClosingSignedDecodeErrorZ {
6455 contents: CResult_ClosingSignedDecodeErrorZPtr {
6456 err: Box::into_raw(Box::new(e)),
6462 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
6463 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
6464 impl Drop for CResult_ClosingSignedDecodeErrorZ {
6465 fn drop(&mut self) {
6467 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6468 let _ = unsafe { Box::from_raw(self.contents.result) };
6471 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6472 let _ = unsafe { Box::from_raw(self.contents.err) };
6477 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ClosingSigned, crate::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
6478 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ClosingSigned, crate::ln::msgs::DecodeError>) -> Self {
6479 let contents = if o.result_ok {
6480 let result = unsafe { o.contents.result };
6481 unsafe { o.contents.result = std::ptr::null_mut() };
6482 CResult_ClosingSignedDecodeErrorZPtr { result }
6484 let err = unsafe { o.contents.err };
6485 unsafe { o.contents.err = std::ptr::null_mut(); }
6486 CResult_ClosingSignedDecodeErrorZPtr { err }
6490 result_ok: o.result_ok,
6494 impl Clone for CResult_ClosingSignedDecodeErrorZ {
6495 fn clone(&self) -> Self {
6497 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
6498 result: Box::into_raw(Box::new(<crate::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
6501 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
6502 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6508 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
6509 /// but with all dynamically-allocated buffers duplicated in new buffers.
6510 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { orig.clone() }
6512 /// The contents of CResult_CommitmentSignedDecodeErrorZ
6513 pub union CResult_CommitmentSignedDecodeErrorZPtr {
6514 /// A pointer to the contents in the success state.
6515 /// Reading from this pointer when `result_ok` is not set is undefined.
6516 pub result: *mut crate::ln::msgs::CommitmentSigned,
6517 /// A pointer to the contents in the error state.
6518 /// Reading from this pointer when `result_ok` is set is undefined.
6519 pub err: *mut crate::ln::msgs::DecodeError,
6522 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
6523 /// containing a crate::ln::msgs::CommitmentSigned on success and a crate::ln::msgs::DecodeError on failure.
6524 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6525 pub struct CResult_CommitmentSignedDecodeErrorZ {
6526 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
6527 /// `err` or `result` depending on the state of `result_ok`.
6528 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
6529 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
6530 pub result_ok: bool,
6533 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
6534 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
6535 CResult_CommitmentSignedDecodeErrorZ {
6536 contents: CResult_CommitmentSignedDecodeErrorZPtr {
6537 result: Box::into_raw(Box::new(o)),
6543 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
6544 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
6545 CResult_CommitmentSignedDecodeErrorZ {
6546 contents: CResult_CommitmentSignedDecodeErrorZPtr {
6547 err: Box::into_raw(Box::new(e)),
6553 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
6554 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
6555 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
6556 fn drop(&mut self) {
6558 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6559 let _ = unsafe { Box::from_raw(self.contents.result) };
6562 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6563 let _ = unsafe { Box::from_raw(self.contents.err) };
6568 impl From<crate::c_types::CResultTempl<crate::ln::msgs::CommitmentSigned, crate::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
6569 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::CommitmentSigned, crate::ln::msgs::DecodeError>) -> Self {
6570 let contents = if o.result_ok {
6571 let result = unsafe { o.contents.result };
6572 unsafe { o.contents.result = std::ptr::null_mut() };
6573 CResult_CommitmentSignedDecodeErrorZPtr { result }
6575 let err = unsafe { o.contents.err };
6576 unsafe { o.contents.err = std::ptr::null_mut(); }
6577 CResult_CommitmentSignedDecodeErrorZPtr { err }
6581 result_ok: o.result_ok,
6585 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
6586 fn clone(&self) -> Self {
6588 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
6589 result: Box::into_raw(Box::new(<crate::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
6592 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
6593 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6599 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
6600 /// but with all dynamically-allocated buffers duplicated in new buffers.
6601 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { orig.clone() }
6603 /// The contents of CResult_FundingCreatedDecodeErrorZ
6604 pub union CResult_FundingCreatedDecodeErrorZPtr {
6605 /// A pointer to the contents in the success state.
6606 /// Reading from this pointer when `result_ok` is not set is undefined.
6607 pub result: *mut crate::ln::msgs::FundingCreated,
6608 /// A pointer to the contents in the error state.
6609 /// Reading from this pointer when `result_ok` is set is undefined.
6610 pub err: *mut crate::ln::msgs::DecodeError,
6613 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
6614 /// containing a crate::ln::msgs::FundingCreated on success and a crate::ln::msgs::DecodeError on failure.
6615 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6616 pub struct CResult_FundingCreatedDecodeErrorZ {
6617 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
6618 /// `err` or `result` depending on the state of `result_ok`.
6619 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
6620 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
6621 pub result_ok: bool,
6624 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
6625 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
6626 CResult_FundingCreatedDecodeErrorZ {
6627 contents: CResult_FundingCreatedDecodeErrorZPtr {
6628 result: Box::into_raw(Box::new(o)),
6634 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
6635 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
6636 CResult_FundingCreatedDecodeErrorZ {
6637 contents: CResult_FundingCreatedDecodeErrorZPtr {
6638 err: Box::into_raw(Box::new(e)),
6644 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
6645 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
6646 impl Drop for CResult_FundingCreatedDecodeErrorZ {
6647 fn drop(&mut self) {
6649 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6650 let _ = unsafe { Box::from_raw(self.contents.result) };
6653 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6654 let _ = unsafe { Box::from_raw(self.contents.err) };
6659 impl From<crate::c_types::CResultTempl<crate::ln::msgs::FundingCreated, crate::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
6660 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::FundingCreated, crate::ln::msgs::DecodeError>) -> Self {
6661 let contents = if o.result_ok {
6662 let result = unsafe { o.contents.result };
6663 unsafe { o.contents.result = std::ptr::null_mut() };
6664 CResult_FundingCreatedDecodeErrorZPtr { result }
6666 let err = unsafe { o.contents.err };
6667 unsafe { o.contents.err = std::ptr::null_mut(); }
6668 CResult_FundingCreatedDecodeErrorZPtr { err }
6672 result_ok: o.result_ok,
6676 impl Clone for CResult_FundingCreatedDecodeErrorZ {
6677 fn clone(&self) -> Self {
6679 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
6680 result: Box::into_raw(Box::new(<crate::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
6683 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
6684 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6690 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
6691 /// but with all dynamically-allocated buffers duplicated in new buffers.
6692 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { orig.clone() }
6694 /// The contents of CResult_FundingSignedDecodeErrorZ
6695 pub union CResult_FundingSignedDecodeErrorZPtr {
6696 /// A pointer to the contents in the success state.
6697 /// Reading from this pointer when `result_ok` is not set is undefined.
6698 pub result: *mut crate::ln::msgs::FundingSigned,
6699 /// A pointer to the contents in the error state.
6700 /// Reading from this pointer when `result_ok` is set is undefined.
6701 pub err: *mut crate::ln::msgs::DecodeError,
6704 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
6705 /// containing a crate::ln::msgs::FundingSigned on success and a crate::ln::msgs::DecodeError on failure.
6706 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6707 pub struct CResult_FundingSignedDecodeErrorZ {
6708 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
6709 /// `err` or `result` depending on the state of `result_ok`.
6710 pub contents: CResult_FundingSignedDecodeErrorZPtr,
6711 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
6712 pub result_ok: bool,
6715 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
6716 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
6717 CResult_FundingSignedDecodeErrorZ {
6718 contents: CResult_FundingSignedDecodeErrorZPtr {
6719 result: Box::into_raw(Box::new(o)),
6725 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
6726 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
6727 CResult_FundingSignedDecodeErrorZ {
6728 contents: CResult_FundingSignedDecodeErrorZPtr {
6729 err: Box::into_raw(Box::new(e)),
6735 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
6736 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
6737 impl Drop for CResult_FundingSignedDecodeErrorZ {
6738 fn drop(&mut self) {
6740 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6741 let _ = unsafe { Box::from_raw(self.contents.result) };
6744 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6745 let _ = unsafe { Box::from_raw(self.contents.err) };
6750 impl From<crate::c_types::CResultTempl<crate::ln::msgs::FundingSigned, crate::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
6751 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::FundingSigned, crate::ln::msgs::DecodeError>) -> Self {
6752 let contents = if o.result_ok {
6753 let result = unsafe { o.contents.result };
6754 unsafe { o.contents.result = std::ptr::null_mut() };
6755 CResult_FundingSignedDecodeErrorZPtr { result }
6757 let err = unsafe { o.contents.err };
6758 unsafe { o.contents.err = std::ptr::null_mut(); }
6759 CResult_FundingSignedDecodeErrorZPtr { err }
6763 result_ok: o.result_ok,
6767 impl Clone for CResult_FundingSignedDecodeErrorZ {
6768 fn clone(&self) -> Self {
6770 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
6771 result: Box::into_raw(Box::new(<crate::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
6774 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
6775 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6781 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
6782 /// but with all dynamically-allocated buffers duplicated in new buffers.
6783 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { orig.clone() }
6785 /// The contents of CResult_FundingLockedDecodeErrorZ
6786 pub union CResult_FundingLockedDecodeErrorZPtr {
6787 /// A pointer to the contents in the success state.
6788 /// Reading from this pointer when `result_ok` is not set is undefined.
6789 pub result: *mut crate::ln::msgs::FundingLocked,
6790 /// A pointer to the contents in the error state.
6791 /// Reading from this pointer when `result_ok` is set is undefined.
6792 pub err: *mut crate::ln::msgs::DecodeError,
6795 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
6796 /// containing a crate::ln::msgs::FundingLocked on success and a crate::ln::msgs::DecodeError on failure.
6797 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6798 pub struct CResult_FundingLockedDecodeErrorZ {
6799 /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
6800 /// `err` or `result` depending on the state of `result_ok`.
6801 pub contents: CResult_FundingLockedDecodeErrorZPtr,
6802 /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
6803 pub result_ok: bool,
6806 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
6807 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
6808 CResult_FundingLockedDecodeErrorZ {
6809 contents: CResult_FundingLockedDecodeErrorZPtr {
6810 result: Box::into_raw(Box::new(o)),
6816 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
6817 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
6818 CResult_FundingLockedDecodeErrorZ {
6819 contents: CResult_FundingLockedDecodeErrorZPtr {
6820 err: Box::into_raw(Box::new(e)),
6826 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
6827 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
6828 impl Drop for CResult_FundingLockedDecodeErrorZ {
6829 fn drop(&mut self) {
6831 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6832 let _ = unsafe { Box::from_raw(self.contents.result) };
6835 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6836 let _ = unsafe { Box::from_raw(self.contents.err) };
6841 impl From<crate::c_types::CResultTempl<crate::ln::msgs::FundingLocked, crate::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
6842 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::FundingLocked, crate::ln::msgs::DecodeError>) -> Self {
6843 let contents = if o.result_ok {
6844 let result = unsafe { o.contents.result };
6845 unsafe { o.contents.result = std::ptr::null_mut() };
6846 CResult_FundingLockedDecodeErrorZPtr { result }
6848 let err = unsafe { o.contents.err };
6849 unsafe { o.contents.err = std::ptr::null_mut(); }
6850 CResult_FundingLockedDecodeErrorZPtr { err }
6854 result_ok: o.result_ok,
6858 impl Clone for CResult_FundingLockedDecodeErrorZ {
6859 fn clone(&self) -> Self {
6861 Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
6862 result: Box::into_raw(Box::new(<crate::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
6865 Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
6866 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6872 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
6873 /// but with all dynamically-allocated buffers duplicated in new buffers.
6874 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { orig.clone() }
6876 /// The contents of CResult_InitDecodeErrorZ
6877 pub union CResult_InitDecodeErrorZPtr {
6878 /// A pointer to the contents in the success state.
6879 /// Reading from this pointer when `result_ok` is not set is undefined.
6880 pub result: *mut crate::ln::msgs::Init,
6881 /// A pointer to the contents in the error state.
6882 /// Reading from this pointer when `result_ok` is set is undefined.
6883 pub err: *mut crate::ln::msgs::DecodeError,
6886 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
6887 /// containing a crate::ln::msgs::Init on success and a crate::ln::msgs::DecodeError on failure.
6888 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6889 pub struct CResult_InitDecodeErrorZ {
6890 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
6891 /// `err` or `result` depending on the state of `result_ok`.
6892 pub contents: CResult_InitDecodeErrorZPtr,
6893 /// Whether this CResult_InitDecodeErrorZ represents a success state.
6894 pub result_ok: bool,
6897 /// Creates a new CResult_InitDecodeErrorZ in the success state.
6898 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
6899 CResult_InitDecodeErrorZ {
6900 contents: CResult_InitDecodeErrorZPtr {
6901 result: Box::into_raw(Box::new(o)),
6907 /// Creates a new CResult_InitDecodeErrorZ in the error state.
6908 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
6909 CResult_InitDecodeErrorZ {
6910 contents: CResult_InitDecodeErrorZPtr {
6911 err: Box::into_raw(Box::new(e)),
6917 /// Frees any resources used by the CResult_InitDecodeErrorZ.
6918 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
6919 impl Drop for CResult_InitDecodeErrorZ {
6920 fn drop(&mut self) {
6922 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6923 let _ = unsafe { Box::from_raw(self.contents.result) };
6926 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6927 let _ = unsafe { Box::from_raw(self.contents.err) };
6932 impl From<crate::c_types::CResultTempl<crate::ln::msgs::Init, crate::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
6933 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::Init, crate::ln::msgs::DecodeError>) -> Self {
6934 let contents = if o.result_ok {
6935 let result = unsafe { o.contents.result };
6936 unsafe { o.contents.result = std::ptr::null_mut() };
6937 CResult_InitDecodeErrorZPtr { result }
6939 let err = unsafe { o.contents.err };
6940 unsafe { o.contents.err = std::ptr::null_mut(); }
6941 CResult_InitDecodeErrorZPtr { err }
6945 result_ok: o.result_ok,
6949 impl Clone for CResult_InitDecodeErrorZ {
6950 fn clone(&self) -> Self {
6952 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
6953 result: Box::into_raw(Box::new(<crate::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
6956 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
6957 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6963 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
6964 /// but with all dynamically-allocated buffers duplicated in new buffers.
6965 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { orig.clone() }
6967 /// The contents of CResult_OpenChannelDecodeErrorZ
6968 pub union CResult_OpenChannelDecodeErrorZPtr {
6969 /// A pointer to the contents in the success state.
6970 /// Reading from this pointer when `result_ok` is not set is undefined.
6971 pub result: *mut crate::ln::msgs::OpenChannel,
6972 /// A pointer to the contents in the error state.
6973 /// Reading from this pointer when `result_ok` is set is undefined.
6974 pub err: *mut crate::ln::msgs::DecodeError,
6977 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
6978 /// containing a crate::ln::msgs::OpenChannel on success and a crate::ln::msgs::DecodeError on failure.
6979 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6980 pub struct CResult_OpenChannelDecodeErrorZ {
6981 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
6982 /// `err` or `result` depending on the state of `result_ok`.
6983 pub contents: CResult_OpenChannelDecodeErrorZPtr,
6984 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
6985 pub result_ok: bool,
6988 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
6989 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
6990 CResult_OpenChannelDecodeErrorZ {
6991 contents: CResult_OpenChannelDecodeErrorZPtr {
6992 result: Box::into_raw(Box::new(o)),
6998 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
6999 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
7000 CResult_OpenChannelDecodeErrorZ {
7001 contents: CResult_OpenChannelDecodeErrorZPtr {
7002 err: Box::into_raw(Box::new(e)),
7008 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
7009 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
7010 impl Drop for CResult_OpenChannelDecodeErrorZ {
7011 fn drop(&mut self) {
7013 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7014 let _ = unsafe { Box::from_raw(self.contents.result) };
7017 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7018 let _ = unsafe { Box::from_raw(self.contents.err) };
7023 impl From<crate::c_types::CResultTempl<crate::ln::msgs::OpenChannel, crate::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
7024 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::OpenChannel, crate::ln::msgs::DecodeError>) -> Self {
7025 let contents = if o.result_ok {
7026 let result = unsafe { o.contents.result };
7027 unsafe { o.contents.result = std::ptr::null_mut() };
7028 CResult_OpenChannelDecodeErrorZPtr { result }
7030 let err = unsafe { o.contents.err };
7031 unsafe { o.contents.err = std::ptr::null_mut(); }
7032 CResult_OpenChannelDecodeErrorZPtr { err }
7036 result_ok: o.result_ok,
7040 impl Clone for CResult_OpenChannelDecodeErrorZ {
7041 fn clone(&self) -> Self {
7043 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
7044 result: Box::into_raw(Box::new(<crate::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
7047 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
7048 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7054 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
7055 /// but with all dynamically-allocated buffers duplicated in new buffers.
7056 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { orig.clone() }
7058 /// The contents of CResult_RevokeAndACKDecodeErrorZ
7059 pub union CResult_RevokeAndACKDecodeErrorZPtr {
7060 /// A pointer to the contents in the success state.
7061 /// Reading from this pointer when `result_ok` is not set is undefined.
7062 pub result: *mut crate::ln::msgs::RevokeAndACK,
7063 /// A pointer to the contents in the error state.
7064 /// Reading from this pointer when `result_ok` is set is undefined.
7065 pub err: *mut crate::ln::msgs::DecodeError,
7068 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
7069 /// containing a crate::ln::msgs::RevokeAndACK on success and a crate::ln::msgs::DecodeError on failure.
7070 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7071 pub struct CResult_RevokeAndACKDecodeErrorZ {
7072 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
7073 /// `err` or `result` depending on the state of `result_ok`.
7074 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
7075 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
7076 pub result_ok: bool,
7079 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
7080 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
7081 CResult_RevokeAndACKDecodeErrorZ {
7082 contents: CResult_RevokeAndACKDecodeErrorZPtr {
7083 result: Box::into_raw(Box::new(o)),
7089 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
7090 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
7091 CResult_RevokeAndACKDecodeErrorZ {
7092 contents: CResult_RevokeAndACKDecodeErrorZPtr {
7093 err: Box::into_raw(Box::new(e)),
7099 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
7100 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
7101 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
7102 fn drop(&mut self) {
7104 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7105 let _ = unsafe { Box::from_raw(self.contents.result) };
7108 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7109 let _ = unsafe { Box::from_raw(self.contents.err) };
7114 impl From<crate::c_types::CResultTempl<crate::ln::msgs::RevokeAndACK, crate::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
7115 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::RevokeAndACK, crate::ln::msgs::DecodeError>) -> Self {
7116 let contents = if o.result_ok {
7117 let result = unsafe { o.contents.result };
7118 unsafe { o.contents.result = std::ptr::null_mut() };
7119 CResult_RevokeAndACKDecodeErrorZPtr { result }
7121 let err = unsafe { o.contents.err };
7122 unsafe { o.contents.err = std::ptr::null_mut(); }
7123 CResult_RevokeAndACKDecodeErrorZPtr { err }
7127 result_ok: o.result_ok,
7131 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
7132 fn clone(&self) -> Self {
7134 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
7135 result: Box::into_raw(Box::new(<crate::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
7138 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
7139 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7145 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
7146 /// but with all dynamically-allocated buffers duplicated in new buffers.
7147 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { orig.clone() }
7149 /// The contents of CResult_ShutdownDecodeErrorZ
7150 pub union CResult_ShutdownDecodeErrorZPtr {
7151 /// A pointer to the contents in the success state.
7152 /// Reading from this pointer when `result_ok` is not set is undefined.
7153 pub result: *mut crate::ln::msgs::Shutdown,
7154 /// A pointer to the contents in the error state.
7155 /// Reading from this pointer when `result_ok` is set is undefined.
7156 pub err: *mut crate::ln::msgs::DecodeError,
7159 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
7160 /// containing a crate::ln::msgs::Shutdown on success and a crate::ln::msgs::DecodeError on failure.
7161 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7162 pub struct CResult_ShutdownDecodeErrorZ {
7163 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
7164 /// `err` or `result` depending on the state of `result_ok`.
7165 pub contents: CResult_ShutdownDecodeErrorZPtr,
7166 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
7167 pub result_ok: bool,
7170 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
7171 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
7172 CResult_ShutdownDecodeErrorZ {
7173 contents: CResult_ShutdownDecodeErrorZPtr {
7174 result: Box::into_raw(Box::new(o)),
7180 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
7181 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
7182 CResult_ShutdownDecodeErrorZ {
7183 contents: CResult_ShutdownDecodeErrorZPtr {
7184 err: Box::into_raw(Box::new(e)),
7190 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
7191 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
7192 impl Drop for CResult_ShutdownDecodeErrorZ {
7193 fn drop(&mut self) {
7195 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7196 let _ = unsafe { Box::from_raw(self.contents.result) };
7199 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7200 let _ = unsafe { Box::from_raw(self.contents.err) };
7205 impl From<crate::c_types::CResultTempl<crate::ln::msgs::Shutdown, crate::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
7206 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::Shutdown, crate::ln::msgs::DecodeError>) -> Self {
7207 let contents = if o.result_ok {
7208 let result = unsafe { o.contents.result };
7209 unsafe { o.contents.result = std::ptr::null_mut() };
7210 CResult_ShutdownDecodeErrorZPtr { result }
7212 let err = unsafe { o.contents.err };
7213 unsafe { o.contents.err = std::ptr::null_mut(); }
7214 CResult_ShutdownDecodeErrorZPtr { err }
7218 result_ok: o.result_ok,
7222 impl Clone for CResult_ShutdownDecodeErrorZ {
7223 fn clone(&self) -> Self {
7225 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
7226 result: Box::into_raw(Box::new(<crate::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
7229 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
7230 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7236 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
7237 /// but with all dynamically-allocated buffers duplicated in new buffers.
7238 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { orig.clone() }
7240 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
7241 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
7242 /// A pointer to the contents in the success state.
7243 /// Reading from this pointer when `result_ok` is not set is undefined.
7244 pub result: *mut crate::ln::msgs::UpdateFailHTLC,
7245 /// A pointer to the contents in the error state.
7246 /// Reading from this pointer when `result_ok` is set is undefined.
7247 pub err: *mut crate::ln::msgs::DecodeError,
7250 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
7251 /// containing a crate::ln::msgs::UpdateFailHTLC on success and a crate::ln::msgs::DecodeError on failure.
7252 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7253 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
7254 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
7255 /// `err` or `result` depending on the state of `result_ok`.
7256 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
7257 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
7258 pub result_ok: bool,
7261 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
7262 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
7263 CResult_UpdateFailHTLCDecodeErrorZ {
7264 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
7265 result: Box::into_raw(Box::new(o)),
7271 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
7272 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
7273 CResult_UpdateFailHTLCDecodeErrorZ {
7274 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
7275 err: Box::into_raw(Box::new(e)),
7281 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
7282 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
7283 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
7284 fn drop(&mut self) {
7286 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7287 let _ = unsafe { Box::from_raw(self.contents.result) };
7290 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7291 let _ = unsafe { Box::from_raw(self.contents.err) };
7296 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UpdateFailHTLC, crate::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
7297 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UpdateFailHTLC, crate::ln::msgs::DecodeError>) -> Self {
7298 let contents = if o.result_ok {
7299 let result = unsafe { o.contents.result };
7300 unsafe { o.contents.result = std::ptr::null_mut() };
7301 CResult_UpdateFailHTLCDecodeErrorZPtr { result }
7303 let err = unsafe { o.contents.err };
7304 unsafe { o.contents.err = std::ptr::null_mut(); }
7305 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
7309 result_ok: o.result_ok,
7313 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
7314 fn clone(&self) -> Self {
7316 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
7317 result: Box::into_raw(Box::new(<crate::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
7320 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
7321 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7327 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
7328 /// but with all dynamically-allocated buffers duplicated in new buffers.
7329 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { orig.clone() }
7331 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
7332 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
7333 /// A pointer to the contents in the success state.
7334 /// Reading from this pointer when `result_ok` is not set is undefined.
7335 pub result: *mut crate::ln::msgs::UpdateFailMalformedHTLC,
7336 /// A pointer to the contents in the error state.
7337 /// Reading from this pointer when `result_ok` is set is undefined.
7338 pub err: *mut crate::ln::msgs::DecodeError,
7341 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
7342 /// containing a crate::ln::msgs::UpdateFailMalformedHTLC on success and a crate::ln::msgs::DecodeError on failure.
7343 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7344 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7345 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
7346 /// `err` or `result` depending on the state of `result_ok`.
7347 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
7348 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
7349 pub result_ok: bool,
7352 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
7353 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7354 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7355 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
7356 result: Box::into_raw(Box::new(o)),
7362 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
7363 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7364 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7365 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
7366 err: Box::into_raw(Box::new(e)),
7372 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
7373 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
7374 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7375 fn drop(&mut self) {
7377 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7378 let _ = unsafe { Box::from_raw(self.contents.result) };
7381 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7382 let _ = unsafe { Box::from_raw(self.contents.err) };
7387 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UpdateFailMalformedHTLC, crate::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7388 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UpdateFailMalformedHTLC, crate::ln::msgs::DecodeError>) -> Self {
7389 let contents = if o.result_ok {
7390 let result = unsafe { o.contents.result };
7391 unsafe { o.contents.result = std::ptr::null_mut() };
7392 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
7394 let err = unsafe { o.contents.err };
7395 unsafe { o.contents.err = std::ptr::null_mut(); }
7396 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
7400 result_ok: o.result_ok,
7404 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7405 fn clone(&self) -> Self {
7407 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
7408 result: Box::into_raw(Box::new(<crate::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
7411 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
7412 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7418 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
7419 /// but with all dynamically-allocated buffers duplicated in new buffers.
7420 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { orig.clone() }
7422 /// The contents of CResult_UpdateFeeDecodeErrorZ
7423 pub union CResult_UpdateFeeDecodeErrorZPtr {
7424 /// A pointer to the contents in the success state.
7425 /// Reading from this pointer when `result_ok` is not set is undefined.
7426 pub result: *mut crate::ln::msgs::UpdateFee,
7427 /// A pointer to the contents in the error state.
7428 /// Reading from this pointer when `result_ok` is set is undefined.
7429 pub err: *mut crate::ln::msgs::DecodeError,
7432 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
7433 /// containing a crate::ln::msgs::UpdateFee on success and a crate::ln::msgs::DecodeError on failure.
7434 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7435 pub struct CResult_UpdateFeeDecodeErrorZ {
7436 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
7437 /// `err` or `result` depending on the state of `result_ok`.
7438 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
7439 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
7440 pub result_ok: bool,
7443 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
7444 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
7445 CResult_UpdateFeeDecodeErrorZ {
7446 contents: CResult_UpdateFeeDecodeErrorZPtr {
7447 result: Box::into_raw(Box::new(o)),
7453 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
7454 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
7455 CResult_UpdateFeeDecodeErrorZ {
7456 contents: CResult_UpdateFeeDecodeErrorZPtr {
7457 err: Box::into_raw(Box::new(e)),
7463 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
7464 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
7465 impl Drop for CResult_UpdateFeeDecodeErrorZ {
7466 fn drop(&mut self) {
7468 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7469 let _ = unsafe { Box::from_raw(self.contents.result) };
7472 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7473 let _ = unsafe { Box::from_raw(self.contents.err) };
7478 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UpdateFee, crate::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
7479 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UpdateFee, crate::ln::msgs::DecodeError>) -> Self {
7480 let contents = if o.result_ok {
7481 let result = unsafe { o.contents.result };
7482 unsafe { o.contents.result = std::ptr::null_mut() };
7483 CResult_UpdateFeeDecodeErrorZPtr { result }
7485 let err = unsafe { o.contents.err };
7486 unsafe { o.contents.err = std::ptr::null_mut(); }
7487 CResult_UpdateFeeDecodeErrorZPtr { err }
7491 result_ok: o.result_ok,
7495 impl Clone for CResult_UpdateFeeDecodeErrorZ {
7496 fn clone(&self) -> Self {
7498 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
7499 result: Box::into_raw(Box::new(<crate::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
7502 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
7503 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7509 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
7510 /// but with all dynamically-allocated buffers duplicated in new buffers.
7511 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { orig.clone() }
7513 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
7514 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
7515 /// A pointer to the contents in the success state.
7516 /// Reading from this pointer when `result_ok` is not set is undefined.
7517 pub result: *mut crate::ln::msgs::UpdateFulfillHTLC,
7518 /// A pointer to the contents in the error state.
7519 /// Reading from this pointer when `result_ok` is set is undefined.
7520 pub err: *mut crate::ln::msgs::DecodeError,
7523 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
7524 /// containing a crate::ln::msgs::UpdateFulfillHTLC on success and a crate::ln::msgs::DecodeError on failure.
7525 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7526 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
7527 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
7528 /// `err` or `result` depending on the state of `result_ok`.
7529 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
7530 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
7531 pub result_ok: bool,
7534 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
7535 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
7536 CResult_UpdateFulfillHTLCDecodeErrorZ {
7537 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
7538 result: Box::into_raw(Box::new(o)),
7544 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
7545 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
7546 CResult_UpdateFulfillHTLCDecodeErrorZ {
7547 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
7548 err: Box::into_raw(Box::new(e)),
7554 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
7555 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
7556 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
7557 fn drop(&mut self) {
7559 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7560 let _ = unsafe { Box::from_raw(self.contents.result) };
7563 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7564 let _ = unsafe { Box::from_raw(self.contents.err) };
7569 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UpdateFulfillHTLC, crate::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
7570 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UpdateFulfillHTLC, crate::ln::msgs::DecodeError>) -> Self {
7571 let contents = if o.result_ok {
7572 let result = unsafe { o.contents.result };
7573 unsafe { o.contents.result = std::ptr::null_mut() };
7574 CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
7576 let err = unsafe { o.contents.err };
7577 unsafe { o.contents.err = std::ptr::null_mut(); }
7578 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
7582 result_ok: o.result_ok,
7586 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
7587 fn clone(&self) -> Self {
7589 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
7590 result: Box::into_raw(Box::new(<crate::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
7593 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
7594 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7600 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
7601 /// but with all dynamically-allocated buffers duplicated in new buffers.
7602 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { orig.clone() }
7604 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
7605 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
7606 /// A pointer to the contents in the success state.
7607 /// Reading from this pointer when `result_ok` is not set is undefined.
7608 pub result: *mut crate::ln::msgs::UpdateAddHTLC,
7609 /// A pointer to the contents in the error state.
7610 /// Reading from this pointer when `result_ok` is set is undefined.
7611 pub err: *mut crate::ln::msgs::DecodeError,
7614 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
7615 /// containing a crate::ln::msgs::UpdateAddHTLC on success and a crate::ln::msgs::DecodeError on failure.
7616 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7617 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
7618 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
7619 /// `err` or `result` depending on the state of `result_ok`.
7620 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
7621 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
7622 pub result_ok: bool,
7625 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
7626 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
7627 CResult_UpdateAddHTLCDecodeErrorZ {
7628 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
7629 result: Box::into_raw(Box::new(o)),
7635 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
7636 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
7637 CResult_UpdateAddHTLCDecodeErrorZ {
7638 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
7639 err: Box::into_raw(Box::new(e)),
7645 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
7646 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
7647 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
7648 fn drop(&mut self) {
7650 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7651 let _ = unsafe { Box::from_raw(self.contents.result) };
7654 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7655 let _ = unsafe { Box::from_raw(self.contents.err) };
7660 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UpdateAddHTLC, crate::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
7661 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UpdateAddHTLC, crate::ln::msgs::DecodeError>) -> Self {
7662 let contents = if o.result_ok {
7663 let result = unsafe { o.contents.result };
7664 unsafe { o.contents.result = std::ptr::null_mut() };
7665 CResult_UpdateAddHTLCDecodeErrorZPtr { result }
7667 let err = unsafe { o.contents.err };
7668 unsafe { o.contents.err = std::ptr::null_mut(); }
7669 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
7673 result_ok: o.result_ok,
7677 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
7678 fn clone(&self) -> Self {
7680 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
7681 result: Box::into_raw(Box::new(<crate::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
7684 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
7685 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7691 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
7692 /// but with all dynamically-allocated buffers duplicated in new buffers.
7693 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { orig.clone() }
7695 /// The contents of CResult_PingDecodeErrorZ
7696 pub union CResult_PingDecodeErrorZPtr {
7697 /// A pointer to the contents in the success state.
7698 /// Reading from this pointer when `result_ok` is not set is undefined.
7699 pub result: *mut crate::ln::msgs::Ping,
7700 /// A pointer to the contents in the error state.
7701 /// Reading from this pointer when `result_ok` is set is undefined.
7702 pub err: *mut crate::ln::msgs::DecodeError,
7705 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
7706 /// containing a crate::ln::msgs::Ping on success and a crate::ln::msgs::DecodeError on failure.
7707 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7708 pub struct CResult_PingDecodeErrorZ {
7709 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
7710 /// `err` or `result` depending on the state of `result_ok`.
7711 pub contents: CResult_PingDecodeErrorZPtr,
7712 /// Whether this CResult_PingDecodeErrorZ represents a success state.
7713 pub result_ok: bool,
7716 /// Creates a new CResult_PingDecodeErrorZ in the success state.
7717 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
7718 CResult_PingDecodeErrorZ {
7719 contents: CResult_PingDecodeErrorZPtr {
7720 result: Box::into_raw(Box::new(o)),
7726 /// Creates a new CResult_PingDecodeErrorZ in the error state.
7727 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
7728 CResult_PingDecodeErrorZ {
7729 contents: CResult_PingDecodeErrorZPtr {
7730 err: Box::into_raw(Box::new(e)),
7736 /// Frees any resources used by the CResult_PingDecodeErrorZ.
7737 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
7738 impl Drop for CResult_PingDecodeErrorZ {
7739 fn drop(&mut self) {
7741 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7742 let _ = unsafe { Box::from_raw(self.contents.result) };
7745 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7746 let _ = unsafe { Box::from_raw(self.contents.err) };
7751 impl From<crate::c_types::CResultTempl<crate::ln::msgs::Ping, crate::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
7752 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::Ping, crate::ln::msgs::DecodeError>) -> Self {
7753 let contents = if o.result_ok {
7754 let result = unsafe { o.contents.result };
7755 unsafe { o.contents.result = std::ptr::null_mut() };
7756 CResult_PingDecodeErrorZPtr { result }
7758 let err = unsafe { o.contents.err };
7759 unsafe { o.contents.err = std::ptr::null_mut(); }
7760 CResult_PingDecodeErrorZPtr { err }
7764 result_ok: o.result_ok,
7768 impl Clone for CResult_PingDecodeErrorZ {
7769 fn clone(&self) -> Self {
7771 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
7772 result: Box::into_raw(Box::new(<crate::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
7775 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
7776 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7782 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
7783 /// but with all dynamically-allocated buffers duplicated in new buffers.
7784 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { orig.clone() }
7786 /// The contents of CResult_PongDecodeErrorZ
7787 pub union CResult_PongDecodeErrorZPtr {
7788 /// A pointer to the contents in the success state.
7789 /// Reading from this pointer when `result_ok` is not set is undefined.
7790 pub result: *mut crate::ln::msgs::Pong,
7791 /// A pointer to the contents in the error state.
7792 /// Reading from this pointer when `result_ok` is set is undefined.
7793 pub err: *mut crate::ln::msgs::DecodeError,
7796 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
7797 /// containing a crate::ln::msgs::Pong on success and a crate::ln::msgs::DecodeError on failure.
7798 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7799 pub struct CResult_PongDecodeErrorZ {
7800 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
7801 /// `err` or `result` depending on the state of `result_ok`.
7802 pub contents: CResult_PongDecodeErrorZPtr,
7803 /// Whether this CResult_PongDecodeErrorZ represents a success state.
7804 pub result_ok: bool,
7807 /// Creates a new CResult_PongDecodeErrorZ in the success state.
7808 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
7809 CResult_PongDecodeErrorZ {
7810 contents: CResult_PongDecodeErrorZPtr {
7811 result: Box::into_raw(Box::new(o)),
7817 /// Creates a new CResult_PongDecodeErrorZ in the error state.
7818 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
7819 CResult_PongDecodeErrorZ {
7820 contents: CResult_PongDecodeErrorZPtr {
7821 err: Box::into_raw(Box::new(e)),
7827 /// Frees any resources used by the CResult_PongDecodeErrorZ.
7828 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
7829 impl Drop for CResult_PongDecodeErrorZ {
7830 fn drop(&mut self) {
7832 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7833 let _ = unsafe { Box::from_raw(self.contents.result) };
7836 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7837 let _ = unsafe { Box::from_raw(self.contents.err) };
7842 impl From<crate::c_types::CResultTempl<crate::ln::msgs::Pong, crate::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
7843 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::Pong, crate::ln::msgs::DecodeError>) -> Self {
7844 let contents = if o.result_ok {
7845 let result = unsafe { o.contents.result };
7846 unsafe { o.contents.result = std::ptr::null_mut() };
7847 CResult_PongDecodeErrorZPtr { result }
7849 let err = unsafe { o.contents.err };
7850 unsafe { o.contents.err = std::ptr::null_mut(); }
7851 CResult_PongDecodeErrorZPtr { err }
7855 result_ok: o.result_ok,
7859 impl Clone for CResult_PongDecodeErrorZ {
7860 fn clone(&self) -> Self {
7862 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
7863 result: Box::into_raw(Box::new(<crate::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
7866 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
7867 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7873 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
7874 /// but with all dynamically-allocated buffers duplicated in new buffers.
7875 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { orig.clone() }
7877 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
7878 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
7879 /// A pointer to the contents in the success state.
7880 /// Reading from this pointer when `result_ok` is not set is undefined.
7881 pub result: *mut crate::ln::msgs::UnsignedChannelAnnouncement,
7882 /// A pointer to the contents in the error state.
7883 /// Reading from this pointer when `result_ok` is set is undefined.
7884 pub err: *mut crate::ln::msgs::DecodeError,
7887 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
7888 /// containing a crate::ln::msgs::UnsignedChannelAnnouncement on success and a crate::ln::msgs::DecodeError on failure.
7889 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7890 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7891 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
7892 /// `err` or `result` depending on the state of `result_ok`.
7893 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
7894 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
7895 pub result_ok: bool,
7898 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
7899 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7900 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7901 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
7902 result: Box::into_raw(Box::new(o)),
7908 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
7909 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7910 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7911 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
7912 err: Box::into_raw(Box::new(e)),
7918 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
7919 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
7920 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7921 fn drop(&mut self) {
7923 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7924 let _ = unsafe { Box::from_raw(self.contents.result) };
7927 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7928 let _ = unsafe { Box::from_raw(self.contents.err) };
7933 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UnsignedChannelAnnouncement, crate::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7934 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UnsignedChannelAnnouncement, crate::ln::msgs::DecodeError>) -> Self {
7935 let contents = if o.result_ok {
7936 let result = unsafe { o.contents.result };
7937 unsafe { o.contents.result = std::ptr::null_mut() };
7938 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
7940 let err = unsafe { o.contents.err };
7941 unsafe { o.contents.err = std::ptr::null_mut(); }
7942 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
7946 result_ok: o.result_ok,
7950 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7951 fn clone(&self) -> Self {
7953 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
7954 result: Box::into_raw(Box::new(<crate::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
7957 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
7958 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7964 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
7965 /// but with all dynamically-allocated buffers duplicated in new buffers.
7966 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { orig.clone() }
7968 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
7969 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
7970 /// A pointer to the contents in the success state.
7971 /// Reading from this pointer when `result_ok` is not set is undefined.
7972 pub result: *mut crate::ln::msgs::ChannelAnnouncement,
7973 /// A pointer to the contents in the error state.
7974 /// Reading from this pointer when `result_ok` is set is undefined.
7975 pub err: *mut crate::ln::msgs::DecodeError,
7978 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
7979 /// containing a crate::ln::msgs::ChannelAnnouncement on success and a crate::ln::msgs::DecodeError on failure.
7980 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7981 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
7982 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
7983 /// `err` or `result` depending on the state of `result_ok`.
7984 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
7985 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
7986 pub result_ok: bool,
7989 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
7990 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
7991 CResult_ChannelAnnouncementDecodeErrorZ {
7992 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
7993 result: Box::into_raw(Box::new(o)),
7999 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
8000 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
8001 CResult_ChannelAnnouncementDecodeErrorZ {
8002 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
8003 err: Box::into_raw(Box::new(e)),
8009 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
8010 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
8011 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
8012 fn drop(&mut self) {
8014 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8015 let _ = unsafe { Box::from_raw(self.contents.result) };
8018 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8019 let _ = unsafe { Box::from_raw(self.contents.err) };
8024 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
8025 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::DecodeError>) -> Self {
8026 let contents = if o.result_ok {
8027 let result = unsafe { o.contents.result };
8028 unsafe { o.contents.result = std::ptr::null_mut() };
8029 CResult_ChannelAnnouncementDecodeErrorZPtr { result }
8031 let err = unsafe { o.contents.err };
8032 unsafe { o.contents.err = std::ptr::null_mut(); }
8033 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
8037 result_ok: o.result_ok,
8041 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
8042 fn clone(&self) -> Self {
8044 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
8045 result: Box::into_raw(Box::new(<crate::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
8048 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
8049 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8055 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
8056 /// but with all dynamically-allocated buffers duplicated in new buffers.
8057 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { orig.clone() }
8059 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
8060 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
8061 /// A pointer to the contents in the success state.
8062 /// Reading from this pointer when `result_ok` is not set is undefined.
8063 pub result: *mut crate::ln::msgs::UnsignedChannelUpdate,
8064 /// A pointer to the contents in the error state.
8065 /// Reading from this pointer when `result_ok` is set is undefined.
8066 pub err: *mut crate::ln::msgs::DecodeError,
8069 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
8070 /// containing a crate::ln::msgs::UnsignedChannelUpdate on success and a crate::ln::msgs::DecodeError on failure.
8071 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8072 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
8073 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
8074 /// `err` or `result` depending on the state of `result_ok`.
8075 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
8076 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
8077 pub result_ok: bool,
8080 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
8081 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
8082 CResult_UnsignedChannelUpdateDecodeErrorZ {
8083 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
8084 result: Box::into_raw(Box::new(o)),
8090 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
8091 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
8092 CResult_UnsignedChannelUpdateDecodeErrorZ {
8093 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
8094 err: Box::into_raw(Box::new(e)),
8100 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
8101 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
8102 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
8103 fn drop(&mut self) {
8105 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8106 let _ = unsafe { Box::from_raw(self.contents.result) };
8109 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8110 let _ = unsafe { Box::from_raw(self.contents.err) };
8115 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UnsignedChannelUpdate, crate::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
8116 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UnsignedChannelUpdate, crate::ln::msgs::DecodeError>) -> Self {
8117 let contents = if o.result_ok {
8118 let result = unsafe { o.contents.result };
8119 unsafe { o.contents.result = std::ptr::null_mut() };
8120 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
8122 let err = unsafe { o.contents.err };
8123 unsafe { o.contents.err = std::ptr::null_mut(); }
8124 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
8128 result_ok: o.result_ok,
8132 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
8133 fn clone(&self) -> Self {
8135 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
8136 result: Box::into_raw(Box::new(<crate::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
8139 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
8140 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8146 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
8147 /// but with all dynamically-allocated buffers duplicated in new buffers.
8148 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { orig.clone() }
8150 /// The contents of CResult_ChannelUpdateDecodeErrorZ
8151 pub union CResult_ChannelUpdateDecodeErrorZPtr {
8152 /// A pointer to the contents in the success state.
8153 /// Reading from this pointer when `result_ok` is not set is undefined.
8154 pub result: *mut crate::ln::msgs::ChannelUpdate,
8155 /// A pointer to the contents in the error state.
8156 /// Reading from this pointer when `result_ok` is set is undefined.
8157 pub err: *mut crate::ln::msgs::DecodeError,
8160 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
8161 /// containing a crate::ln::msgs::ChannelUpdate on success and a crate::ln::msgs::DecodeError on failure.
8162 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8163 pub struct CResult_ChannelUpdateDecodeErrorZ {
8164 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
8165 /// `err` or `result` depending on the state of `result_ok`.
8166 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
8167 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
8168 pub result_ok: bool,
8171 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
8172 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
8173 CResult_ChannelUpdateDecodeErrorZ {
8174 contents: CResult_ChannelUpdateDecodeErrorZPtr {
8175 result: Box::into_raw(Box::new(o)),
8181 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
8182 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
8183 CResult_ChannelUpdateDecodeErrorZ {
8184 contents: CResult_ChannelUpdateDecodeErrorZPtr {
8185 err: Box::into_raw(Box::new(e)),
8191 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
8192 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
8193 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
8194 fn drop(&mut self) {
8196 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8197 let _ = unsafe { Box::from_raw(self.contents.result) };
8200 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8201 let _ = unsafe { Box::from_raw(self.contents.err) };
8206 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ChannelUpdate, crate::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
8207 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ChannelUpdate, crate::ln::msgs::DecodeError>) -> Self {
8208 let contents = if o.result_ok {
8209 let result = unsafe { o.contents.result };
8210 unsafe { o.contents.result = std::ptr::null_mut() };
8211 CResult_ChannelUpdateDecodeErrorZPtr { result }
8213 let err = unsafe { o.contents.err };
8214 unsafe { o.contents.err = std::ptr::null_mut(); }
8215 CResult_ChannelUpdateDecodeErrorZPtr { err }
8219 result_ok: o.result_ok,
8223 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
8224 fn clone(&self) -> Self {
8226 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
8227 result: Box::into_raw(Box::new(<crate::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
8230 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
8231 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8237 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
8238 /// but with all dynamically-allocated buffers duplicated in new buffers.
8239 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { orig.clone() }
8241 /// The contents of CResult_ErrorMessageDecodeErrorZ
8242 pub union CResult_ErrorMessageDecodeErrorZPtr {
8243 /// A pointer to the contents in the success state.
8244 /// Reading from this pointer when `result_ok` is not set is undefined.
8245 pub result: *mut crate::ln::msgs::ErrorMessage,
8246 /// A pointer to the contents in the error state.
8247 /// Reading from this pointer when `result_ok` is set is undefined.
8248 pub err: *mut crate::ln::msgs::DecodeError,
8251 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
8252 /// containing a crate::ln::msgs::ErrorMessage on success and a crate::ln::msgs::DecodeError on failure.
8253 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8254 pub struct CResult_ErrorMessageDecodeErrorZ {
8255 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
8256 /// `err` or `result` depending on the state of `result_ok`.
8257 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
8258 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
8259 pub result_ok: bool,
8262 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
8263 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
8264 CResult_ErrorMessageDecodeErrorZ {
8265 contents: CResult_ErrorMessageDecodeErrorZPtr {
8266 result: Box::into_raw(Box::new(o)),
8272 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
8273 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
8274 CResult_ErrorMessageDecodeErrorZ {
8275 contents: CResult_ErrorMessageDecodeErrorZPtr {
8276 err: Box::into_raw(Box::new(e)),
8282 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
8283 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
8284 impl Drop for CResult_ErrorMessageDecodeErrorZ {
8285 fn drop(&mut self) {
8287 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8288 let _ = unsafe { Box::from_raw(self.contents.result) };
8291 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8292 let _ = unsafe { Box::from_raw(self.contents.err) };
8297 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ErrorMessage, crate::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
8298 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ErrorMessage, crate::ln::msgs::DecodeError>) -> Self {
8299 let contents = if o.result_ok {
8300 let result = unsafe { o.contents.result };
8301 unsafe { o.contents.result = std::ptr::null_mut() };
8302 CResult_ErrorMessageDecodeErrorZPtr { result }
8304 let err = unsafe { o.contents.err };
8305 unsafe { o.contents.err = std::ptr::null_mut(); }
8306 CResult_ErrorMessageDecodeErrorZPtr { err }
8310 result_ok: o.result_ok,
8314 impl Clone for CResult_ErrorMessageDecodeErrorZ {
8315 fn clone(&self) -> Self {
8317 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
8318 result: Box::into_raw(Box::new(<crate::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
8321 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
8322 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8328 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
8329 /// but with all dynamically-allocated buffers duplicated in new buffers.
8330 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { orig.clone() }
8332 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
8333 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
8334 /// A pointer to the contents in the success state.
8335 /// Reading from this pointer when `result_ok` is not set is undefined.
8336 pub result: *mut crate::ln::msgs::UnsignedNodeAnnouncement,
8337 /// A pointer to the contents in the error state.
8338 /// Reading from this pointer when `result_ok` is set is undefined.
8339 pub err: *mut crate::ln::msgs::DecodeError,
8342 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
8343 /// containing a crate::ln::msgs::UnsignedNodeAnnouncement on success and a crate::ln::msgs::DecodeError on failure.
8344 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8345 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8346 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
8347 /// `err` or `result` depending on the state of `result_ok`.
8348 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
8349 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
8350 pub result_ok: bool,
8353 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
8354 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8355 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8356 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
8357 result: Box::into_raw(Box::new(o)),
8363 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
8364 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8365 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8366 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
8367 err: Box::into_raw(Box::new(e)),
8373 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
8374 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
8375 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8376 fn drop(&mut self) {
8378 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8379 let _ = unsafe { Box::from_raw(self.contents.result) };
8382 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8383 let _ = unsafe { Box::from_raw(self.contents.err) };
8388 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UnsignedNodeAnnouncement, crate::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8389 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UnsignedNodeAnnouncement, crate::ln::msgs::DecodeError>) -> Self {
8390 let contents = if o.result_ok {
8391 let result = unsafe { o.contents.result };
8392 unsafe { o.contents.result = std::ptr::null_mut() };
8393 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
8395 let err = unsafe { o.contents.err };
8396 unsafe { o.contents.err = std::ptr::null_mut(); }
8397 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
8401 result_ok: o.result_ok,
8405 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8406 fn clone(&self) -> Self {
8408 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
8409 result: Box::into_raw(Box::new(<crate::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
8412 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
8413 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8419 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
8420 /// but with all dynamically-allocated buffers duplicated in new buffers.
8421 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { orig.clone() }
8423 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
8424 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
8425 /// A pointer to the contents in the success state.
8426 /// Reading from this pointer when `result_ok` is not set is undefined.
8427 pub result: *mut crate::ln::msgs::NodeAnnouncement,
8428 /// A pointer to the contents in the error state.
8429 /// Reading from this pointer when `result_ok` is set is undefined.
8430 pub err: *mut crate::ln::msgs::DecodeError,
8433 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
8434 /// containing a crate::ln::msgs::NodeAnnouncement on success and a crate::ln::msgs::DecodeError on failure.
8435 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8436 pub struct CResult_NodeAnnouncementDecodeErrorZ {
8437 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
8438 /// `err` or `result` depending on the state of `result_ok`.
8439 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
8440 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
8441 pub result_ok: bool,
8444 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
8445 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
8446 CResult_NodeAnnouncementDecodeErrorZ {
8447 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
8448 result: Box::into_raw(Box::new(o)),
8454 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
8455 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
8456 CResult_NodeAnnouncementDecodeErrorZ {
8457 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
8458 err: Box::into_raw(Box::new(e)),
8464 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
8465 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
8466 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
8467 fn drop(&mut self) {
8469 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8470 let _ = unsafe { Box::from_raw(self.contents.result) };
8473 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8474 let _ = unsafe { Box::from_raw(self.contents.err) };
8479 impl From<crate::c_types::CResultTempl<crate::ln::msgs::NodeAnnouncement, crate::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
8480 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::NodeAnnouncement, crate::ln::msgs::DecodeError>) -> Self {
8481 let contents = if o.result_ok {
8482 let result = unsafe { o.contents.result };
8483 unsafe { o.contents.result = std::ptr::null_mut() };
8484 CResult_NodeAnnouncementDecodeErrorZPtr { result }
8486 let err = unsafe { o.contents.err };
8487 unsafe { o.contents.err = std::ptr::null_mut(); }
8488 CResult_NodeAnnouncementDecodeErrorZPtr { err }
8492 result_ok: o.result_ok,
8496 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
8497 fn clone(&self) -> Self {
8499 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
8500 result: Box::into_raw(Box::new(<crate::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
8503 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
8504 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8510 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
8511 /// but with all dynamically-allocated buffers duplicated in new buffers.
8512 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { orig.clone() }
8514 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
8515 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
8516 /// A pointer to the contents in the success state.
8517 /// Reading from this pointer when `result_ok` is not set is undefined.
8518 pub result: *mut crate::ln::msgs::QueryShortChannelIds,
8519 /// A pointer to the contents in the error state.
8520 /// Reading from this pointer when `result_ok` is set is undefined.
8521 pub err: *mut crate::ln::msgs::DecodeError,
8524 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
8525 /// containing a crate::ln::msgs::QueryShortChannelIds on success and a crate::ln::msgs::DecodeError on failure.
8526 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8527 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
8528 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
8529 /// `err` or `result` depending on the state of `result_ok`.
8530 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
8531 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
8532 pub result_ok: bool,
8535 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
8536 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
8537 CResult_QueryShortChannelIdsDecodeErrorZ {
8538 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
8539 result: Box::into_raw(Box::new(o)),
8545 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
8546 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
8547 CResult_QueryShortChannelIdsDecodeErrorZ {
8548 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
8549 err: Box::into_raw(Box::new(e)),
8555 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
8556 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
8557 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
8558 fn drop(&mut self) {
8560 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8561 let _ = unsafe { Box::from_raw(self.contents.result) };
8564 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8565 let _ = unsafe { Box::from_raw(self.contents.err) };
8570 impl From<crate::c_types::CResultTempl<crate::ln::msgs::QueryShortChannelIds, crate::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
8571 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::QueryShortChannelIds, crate::ln::msgs::DecodeError>) -> Self {
8572 let contents = if o.result_ok {
8573 let result = unsafe { o.contents.result };
8574 unsafe { o.contents.result = std::ptr::null_mut() };
8575 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
8577 let err = unsafe { o.contents.err };
8578 unsafe { o.contents.err = std::ptr::null_mut(); }
8579 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
8583 result_ok: o.result_ok,
8587 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
8588 fn clone(&self) -> Self {
8590 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
8591 result: Box::into_raw(Box::new(<crate::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
8594 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
8595 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8601 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
8602 /// but with all dynamically-allocated buffers duplicated in new buffers.
8603 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { orig.clone() }
8605 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
8606 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
8607 /// A pointer to the contents in the success state.
8608 /// Reading from this pointer when `result_ok` is not set is undefined.
8609 pub result: *mut crate::ln::msgs::ReplyShortChannelIdsEnd,
8610 /// A pointer to the contents in the error state.
8611 /// Reading from this pointer when `result_ok` is set is undefined.
8612 pub err: *mut crate::ln::msgs::DecodeError,
8615 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
8616 /// containing a crate::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::ln::msgs::DecodeError on failure.
8617 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8618 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8619 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
8620 /// `err` or `result` depending on the state of `result_ok`.
8621 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
8622 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
8623 pub result_ok: bool,
8626 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
8627 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8628 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8629 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
8630 result: Box::into_raw(Box::new(o)),
8636 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
8637 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8638 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8639 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
8640 err: Box::into_raw(Box::new(e)),
8646 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
8647 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
8648 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8649 fn drop(&mut self) {
8651 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8652 let _ = unsafe { Box::from_raw(self.contents.result) };
8655 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8656 let _ = unsafe { Box::from_raw(self.contents.err) };
8661 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ReplyShortChannelIdsEnd, crate::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8662 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ReplyShortChannelIdsEnd, crate::ln::msgs::DecodeError>) -> Self {
8663 let contents = if o.result_ok {
8664 let result = unsafe { o.contents.result };
8665 unsafe { o.contents.result = std::ptr::null_mut() };
8666 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
8668 let err = unsafe { o.contents.err };
8669 unsafe { o.contents.err = std::ptr::null_mut(); }
8670 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
8674 result_ok: o.result_ok,
8678 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8679 fn clone(&self) -> Self {
8681 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
8682 result: Box::into_raw(Box::new(<crate::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
8685 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
8686 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8692 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
8693 /// but with all dynamically-allocated buffers duplicated in new buffers.
8694 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { orig.clone() }
8696 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
8697 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
8698 /// A pointer to the contents in the success state.
8699 /// Reading from this pointer when `result_ok` is not set is undefined.
8700 pub result: *mut crate::ln::msgs::QueryChannelRange,
8701 /// A pointer to the contents in the error state.
8702 /// Reading from this pointer when `result_ok` is set is undefined.
8703 pub err: *mut crate::ln::msgs::DecodeError,
8706 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
8707 /// containing a crate::ln::msgs::QueryChannelRange on success and a crate::ln::msgs::DecodeError on failure.
8708 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8709 pub struct CResult_QueryChannelRangeDecodeErrorZ {
8710 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
8711 /// `err` or `result` depending on the state of `result_ok`.
8712 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
8713 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
8714 pub result_ok: bool,
8717 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
8718 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
8719 CResult_QueryChannelRangeDecodeErrorZ {
8720 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
8721 result: Box::into_raw(Box::new(o)),
8727 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
8728 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
8729 CResult_QueryChannelRangeDecodeErrorZ {
8730 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
8731 err: Box::into_raw(Box::new(e)),
8737 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
8738 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
8739 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
8740 fn drop(&mut self) {
8742 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8743 let _ = unsafe { Box::from_raw(self.contents.result) };
8746 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8747 let _ = unsafe { Box::from_raw(self.contents.err) };
8752 impl From<crate::c_types::CResultTempl<crate::ln::msgs::QueryChannelRange, crate::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
8753 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::QueryChannelRange, crate::ln::msgs::DecodeError>) -> Self {
8754 let contents = if o.result_ok {
8755 let result = unsafe { o.contents.result };
8756 unsafe { o.contents.result = std::ptr::null_mut() };
8757 CResult_QueryChannelRangeDecodeErrorZPtr { result }
8759 let err = unsafe { o.contents.err };
8760 unsafe { o.contents.err = std::ptr::null_mut(); }
8761 CResult_QueryChannelRangeDecodeErrorZPtr { err }
8765 result_ok: o.result_ok,
8769 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
8770 fn clone(&self) -> Self {
8772 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
8773 result: Box::into_raw(Box::new(<crate::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
8776 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
8777 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8783 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
8784 /// but with all dynamically-allocated buffers duplicated in new buffers.
8785 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { orig.clone() }
8787 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
8788 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
8789 /// A pointer to the contents in the success state.
8790 /// Reading from this pointer when `result_ok` is not set is undefined.
8791 pub result: *mut crate::ln::msgs::ReplyChannelRange,
8792 /// A pointer to the contents in the error state.
8793 /// Reading from this pointer when `result_ok` is set is undefined.
8794 pub err: *mut crate::ln::msgs::DecodeError,
8797 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
8798 /// containing a crate::ln::msgs::ReplyChannelRange on success and a crate::ln::msgs::DecodeError on failure.
8799 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8800 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
8801 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
8802 /// `err` or `result` depending on the state of `result_ok`.
8803 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
8804 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
8805 pub result_ok: bool,
8808 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
8809 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
8810 CResult_ReplyChannelRangeDecodeErrorZ {
8811 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
8812 result: Box::into_raw(Box::new(o)),
8818 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
8819 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
8820 CResult_ReplyChannelRangeDecodeErrorZ {
8821 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
8822 err: Box::into_raw(Box::new(e)),
8828 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
8829 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
8830 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
8831 fn drop(&mut self) {
8833 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8834 let _ = unsafe { Box::from_raw(self.contents.result) };
8837 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8838 let _ = unsafe { Box::from_raw(self.contents.err) };
8843 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ReplyChannelRange, crate::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
8844 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ReplyChannelRange, crate::ln::msgs::DecodeError>) -> Self {
8845 let contents = if o.result_ok {
8846 let result = unsafe { o.contents.result };
8847 unsafe { o.contents.result = std::ptr::null_mut() };
8848 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
8850 let err = unsafe { o.contents.err };
8851 unsafe { o.contents.err = std::ptr::null_mut(); }
8852 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
8856 result_ok: o.result_ok,
8860 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
8861 fn clone(&self) -> Self {
8863 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
8864 result: Box::into_raw(Box::new(<crate::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
8867 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
8868 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8874 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
8875 /// but with all dynamically-allocated buffers duplicated in new buffers.
8876 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { orig.clone() }
8878 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
8879 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
8880 /// A pointer to the contents in the success state.
8881 /// Reading from this pointer when `result_ok` is not set is undefined.
8882 pub result: *mut crate::ln::msgs::GossipTimestampFilter,
8883 /// A pointer to the contents in the error state.
8884 /// Reading from this pointer when `result_ok` is set is undefined.
8885 pub err: *mut crate::ln::msgs::DecodeError,
8888 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
8889 /// containing a crate::ln::msgs::GossipTimestampFilter on success and a crate::ln::msgs::DecodeError on failure.
8890 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8891 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
8892 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
8893 /// `err` or `result` depending on the state of `result_ok`.
8894 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
8895 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
8896 pub result_ok: bool,
8899 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
8900 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
8901 CResult_GossipTimestampFilterDecodeErrorZ {
8902 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
8903 result: Box::into_raw(Box::new(o)),
8909 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
8910 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
8911 CResult_GossipTimestampFilterDecodeErrorZ {
8912 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
8913 err: Box::into_raw(Box::new(e)),
8919 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
8920 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
8921 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
8922 fn drop(&mut self) {
8924 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8925 let _ = unsafe { Box::from_raw(self.contents.result) };
8928 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8929 let _ = unsafe { Box::from_raw(self.contents.err) };
8934 impl From<crate::c_types::CResultTempl<crate::ln::msgs::GossipTimestampFilter, crate::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
8935 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::GossipTimestampFilter, crate::ln::msgs::DecodeError>) -> Self {
8936 let contents = if o.result_ok {
8937 let result = unsafe { o.contents.result };
8938 unsafe { o.contents.result = std::ptr::null_mut() };
8939 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
8941 let err = unsafe { o.contents.err };
8942 unsafe { o.contents.err = std::ptr::null_mut(); }
8943 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
8947 result_ok: o.result_ok,
8951 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
8952 fn clone(&self) -> Self {
8954 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
8955 result: Box::into_raw(Box::new(<crate::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
8958 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
8959 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8965 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
8966 /// but with all dynamically-allocated buffers duplicated in new buffers.
8967 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { orig.clone() }