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 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
3032 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
3033 /// Note that this value is always NULL, as there are no contents in the OK variant
3034 pub result: *mut std::ffi::c_void,
3035 /// A pointer to the contents in the error state.
3036 /// Reading from this pointer when `result_ok` is set is undefined.
3037 pub err: *mut crate::chain::channelmonitor::ChannelMonitorUpdateErr,
3040 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
3041 /// containing a () on success and a crate::chain::channelmonitor::ChannelMonitorUpdateErr on failure.
3042 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3043 pub struct CResult_NoneChannelMonitorUpdateErrZ {
3044 /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
3045 /// `err` or `result` depending on the state of `result_ok`.
3046 pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
3047 /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
3048 pub result_ok: bool,
3051 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
3052 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
3053 CResult_NoneChannelMonitorUpdateErrZ {
3054 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3055 result: std::ptr::null_mut(),
3061 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
3062 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::chain::channelmonitor::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
3063 CResult_NoneChannelMonitorUpdateErrZ {
3064 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3065 err: Box::into_raw(Box::new(e)),
3071 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
3072 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
3073 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
3074 fn drop(&mut self) {
3077 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3078 let _ = unsafe { Box::from_raw(self.contents.err) };
3083 impl From<crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
3084 fn from(mut o: crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::ChannelMonitorUpdateErr>) -> Self {
3085 let contents = if o.result_ok {
3086 let _ = unsafe { Box::from_raw(o.contents.result) };
3087 o.contents.result = std::ptr::null_mut();
3088 CResult_NoneChannelMonitorUpdateErrZPtr { result: std::ptr::null_mut() }
3090 let err = unsafe { o.contents.err };
3091 unsafe { o.contents.err = std::ptr::null_mut(); }
3092 CResult_NoneChannelMonitorUpdateErrZPtr { err }
3096 result_ok: o.result_ok,
3100 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
3101 fn clone(&self) -> Self {
3103 Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3104 result: std::ptr::null_mut()
3107 Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3108 err: Box::into_raw(Box::new(<crate::chain::channelmonitor::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
3114 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
3115 /// but with all dynamically-allocated buffers duplicated in new buffers.
3116 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { orig.clone() }
3118 /// A dynamically-allocated array of crate::chain::channelmonitor::MonitorEvents of arbitrary size.
3119 /// This corresponds to std::vector in C++
3120 pub struct CVec_MonitorEventZ {
3121 /// The elements in the array.
3122 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3123 pub data: *mut crate::chain::channelmonitor::MonitorEvent,
3124 /// The number of elements pointed to by `data`.
3127 impl CVec_MonitorEventZ {
3128 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::chain::channelmonitor::MonitorEvent> {
3129 if self.datalen == 0 { return Vec::new(); }
3130 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3131 self.data = std::ptr::null_mut();
3135 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::chain::channelmonitor::MonitorEvent] {
3136 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3139 impl From<Vec<crate::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
3140 fn from(v: Vec<crate::chain::channelmonitor::MonitorEvent>) -> Self {
3141 let datalen = v.len();
3142 let data = Box::into_raw(v.into_boxed_slice());
3143 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3147 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3148 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
3149 impl Drop for CVec_MonitorEventZ {
3150 fn drop(&mut self) {
3151 if self.datalen == 0 { return; }
3152 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3155 impl Clone for CVec_MonitorEventZ {
3156 fn clone(&self) -> Self {
3157 let mut res = Vec::new();
3158 if self.datalen == 0 { return Self::from(res); }
3159 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3164 /// A dynamically-allocated array of crate::util::events::Events of arbitrary size.
3165 /// This corresponds to std::vector in C++
3166 pub struct CVec_EventZ {
3167 /// The elements in the array.
3168 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3169 pub data: *mut crate::util::events::Event,
3170 /// The number of elements pointed to by `data`.
3174 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::util::events::Event> {
3175 if self.datalen == 0 { return Vec::new(); }
3176 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3177 self.data = std::ptr::null_mut();
3181 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::util::events::Event] {
3182 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3185 impl From<Vec<crate::util::events::Event>> for CVec_EventZ {
3186 fn from(v: Vec<crate::util::events::Event>) -> Self {
3187 let datalen = v.len();
3188 let data = Box::into_raw(v.into_boxed_slice());
3189 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3193 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3194 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
3195 impl Drop for CVec_EventZ {
3196 fn drop(&mut self) {
3197 if self.datalen == 0 { return; }
3198 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3201 impl Clone for CVec_EventZ {
3202 fn clone(&self) -> Self {
3203 let mut res = Vec::new();
3204 if self.datalen == 0 { return Self::from(res); }
3205 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3210 /// The contents of CResult_OutPointDecodeErrorZ
3211 pub union CResult_OutPointDecodeErrorZPtr {
3212 /// A pointer to the contents in the success state.
3213 /// Reading from this pointer when `result_ok` is not set is undefined.
3214 pub result: *mut crate::chain::transaction::OutPoint,
3215 /// A pointer to the contents in the error state.
3216 /// Reading from this pointer when `result_ok` is set is undefined.
3217 pub err: *mut crate::ln::msgs::DecodeError,
3220 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
3221 /// containing a crate::chain::transaction::OutPoint on success and a crate::ln::msgs::DecodeError on failure.
3222 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3223 pub struct CResult_OutPointDecodeErrorZ {
3224 /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
3225 /// `err` or `result` depending on the state of `result_ok`.
3226 pub contents: CResult_OutPointDecodeErrorZPtr,
3227 /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
3228 pub result_ok: bool,
3231 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
3232 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
3233 CResult_OutPointDecodeErrorZ {
3234 contents: CResult_OutPointDecodeErrorZPtr {
3235 result: Box::into_raw(Box::new(o)),
3241 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
3242 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
3243 CResult_OutPointDecodeErrorZ {
3244 contents: CResult_OutPointDecodeErrorZPtr {
3245 err: Box::into_raw(Box::new(e)),
3251 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
3252 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
3253 impl Drop for CResult_OutPointDecodeErrorZ {
3254 fn drop(&mut self) {
3256 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3257 let _ = unsafe { Box::from_raw(self.contents.result) };
3260 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3261 let _ = unsafe { Box::from_raw(self.contents.err) };
3266 impl From<crate::c_types::CResultTempl<crate::chain::transaction::OutPoint, crate::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
3267 fn from(mut o: crate::c_types::CResultTempl<crate::chain::transaction::OutPoint, crate::ln::msgs::DecodeError>) -> Self {
3268 let contents = if o.result_ok {
3269 let result = unsafe { o.contents.result };
3270 unsafe { o.contents.result = std::ptr::null_mut() };
3271 CResult_OutPointDecodeErrorZPtr { result }
3273 let err = unsafe { o.contents.err };
3274 unsafe { o.contents.err = std::ptr::null_mut(); }
3275 CResult_OutPointDecodeErrorZPtr { err }
3279 result_ok: o.result_ok,
3283 impl Clone for CResult_OutPointDecodeErrorZ {
3284 fn clone(&self) -> Self {
3286 Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
3287 result: Box::into_raw(Box::new(<crate::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
3290 Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
3291 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3297 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
3298 /// but with all dynamically-allocated buffers duplicated in new buffers.
3299 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { orig.clone() }
3301 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
3302 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
3303 /// A pointer to the contents in the success state.
3304 /// Reading from this pointer when `result_ok` is not set is undefined.
3305 pub result: *mut crate::chain::channelmonitor::ChannelMonitorUpdate,
3306 /// A pointer to the contents in the error state.
3307 /// Reading from this pointer when `result_ok` is set is undefined.
3308 pub err: *mut crate::ln::msgs::DecodeError,
3311 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
3312 /// containing a crate::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::ln::msgs::DecodeError on failure.
3313 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3314 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
3315 /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
3316 /// `err` or `result` depending on the state of `result_ok`.
3317 pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
3318 /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
3319 pub result_ok: bool,
3322 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
3323 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
3324 CResult_ChannelMonitorUpdateDecodeErrorZ {
3325 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
3326 result: Box::into_raw(Box::new(o)),
3332 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
3333 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
3334 CResult_ChannelMonitorUpdateDecodeErrorZ {
3335 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
3336 err: Box::into_raw(Box::new(e)),
3342 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
3343 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
3344 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
3345 fn drop(&mut self) {
3347 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3348 let _ = unsafe { Box::from_raw(self.contents.result) };
3351 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3352 let _ = unsafe { Box::from_raw(self.contents.err) };
3357 impl From<crate::c_types::CResultTempl<crate::chain::channelmonitor::ChannelMonitorUpdate, crate::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
3358 fn from(mut o: crate::c_types::CResultTempl<crate::chain::channelmonitor::ChannelMonitorUpdate, crate::ln::msgs::DecodeError>) -> Self {
3359 let contents = if o.result_ok {
3360 let result = unsafe { o.contents.result };
3361 unsafe { o.contents.result = std::ptr::null_mut() };
3362 CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
3364 let err = unsafe { o.contents.err };
3365 unsafe { o.contents.err = std::ptr::null_mut(); }
3366 CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
3370 result_ok: o.result_ok,
3374 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
3375 fn clone(&self) -> Self {
3377 Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
3378 result: Box::into_raw(Box::new(<crate::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
3381 Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
3382 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3388 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
3389 /// but with all dynamically-allocated buffers duplicated in new buffers.
3390 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { orig.clone() }
3392 /// The contents of CResult_HTLCUpdateDecodeErrorZ
3393 pub union CResult_HTLCUpdateDecodeErrorZPtr {
3394 /// A pointer to the contents in the success state.
3395 /// Reading from this pointer when `result_ok` is not set is undefined.
3396 pub result: *mut crate::chain::channelmonitor::HTLCUpdate,
3397 /// A pointer to the contents in the error state.
3398 /// Reading from this pointer when `result_ok` is set is undefined.
3399 pub err: *mut crate::ln::msgs::DecodeError,
3402 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
3403 /// containing a crate::chain::channelmonitor::HTLCUpdate on success and a crate::ln::msgs::DecodeError on failure.
3404 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3405 pub struct CResult_HTLCUpdateDecodeErrorZ {
3406 /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
3407 /// `err` or `result` depending on the state of `result_ok`.
3408 pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
3409 /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
3410 pub result_ok: bool,
3413 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
3414 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
3415 CResult_HTLCUpdateDecodeErrorZ {
3416 contents: CResult_HTLCUpdateDecodeErrorZPtr {
3417 result: Box::into_raw(Box::new(o)),
3423 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
3424 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
3425 CResult_HTLCUpdateDecodeErrorZ {
3426 contents: CResult_HTLCUpdateDecodeErrorZPtr {
3427 err: Box::into_raw(Box::new(e)),
3433 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
3434 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
3435 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
3436 fn drop(&mut self) {
3438 if unsafe { !(self.contents.result as *mut ()).is_null() } {
3439 let _ = unsafe { Box::from_raw(self.contents.result) };
3442 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3443 let _ = unsafe { Box::from_raw(self.contents.err) };
3448 impl From<crate::c_types::CResultTempl<crate::chain::channelmonitor::HTLCUpdate, crate::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
3449 fn from(mut o: crate::c_types::CResultTempl<crate::chain::channelmonitor::HTLCUpdate, crate::ln::msgs::DecodeError>) -> Self {
3450 let contents = if o.result_ok {
3451 let result = unsafe { o.contents.result };
3452 unsafe { o.contents.result = std::ptr::null_mut() };
3453 CResult_HTLCUpdateDecodeErrorZPtr { result }
3455 let err = unsafe { o.contents.err };
3456 unsafe { o.contents.err = std::ptr::null_mut(); }
3457 CResult_HTLCUpdateDecodeErrorZPtr { err }
3461 result_ok: o.result_ok,
3465 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
3466 fn clone(&self) -> Self {
3468 Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
3469 result: Box::into_raw(Box::new(<crate::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
3472 Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
3473 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3479 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
3480 /// but with all dynamically-allocated buffers duplicated in new buffers.
3481 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { orig.clone() }
3483 /// The contents of CResult_NoneMonitorUpdateErrorZ
3484 pub union CResult_NoneMonitorUpdateErrorZPtr {
3485 /// Note that this value is always NULL, as there are no contents in the OK variant
3486 pub result: *mut std::ffi::c_void,
3487 /// A pointer to the contents in the error state.
3488 /// Reading from this pointer when `result_ok` is set is undefined.
3489 pub err: *mut crate::chain::channelmonitor::MonitorUpdateError,
3492 /// A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
3493 /// containing a () on success and a crate::chain::channelmonitor::MonitorUpdateError on failure.
3494 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3495 pub struct CResult_NoneMonitorUpdateErrorZ {
3496 /// The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
3497 /// `err` or `result` depending on the state of `result_ok`.
3498 pub contents: CResult_NoneMonitorUpdateErrorZPtr,
3499 /// Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
3500 pub result_ok: bool,
3503 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
3504 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_ok() -> CResult_NoneMonitorUpdateErrorZ {
3505 CResult_NoneMonitorUpdateErrorZ {
3506 contents: CResult_NoneMonitorUpdateErrorZPtr {
3507 result: std::ptr::null_mut(),
3513 /// Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
3514 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_err(e: crate::chain::channelmonitor::MonitorUpdateError) -> CResult_NoneMonitorUpdateErrorZ {
3515 CResult_NoneMonitorUpdateErrorZ {
3516 contents: CResult_NoneMonitorUpdateErrorZPtr {
3517 err: Box::into_raw(Box::new(e)),
3523 /// Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
3524 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_free(_res: CResult_NoneMonitorUpdateErrorZ) { }
3525 impl Drop for CResult_NoneMonitorUpdateErrorZ {
3526 fn drop(&mut self) {
3529 if unsafe { !(self.contents.err as *mut ()).is_null() } {
3530 let _ = unsafe { Box::from_raw(self.contents.err) };
3535 impl From<crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::MonitorUpdateError>> for CResult_NoneMonitorUpdateErrorZ {
3536 fn from(mut o: crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::MonitorUpdateError>) -> Self {
3537 let contents = if o.result_ok {
3538 let _ = unsafe { Box::from_raw(o.contents.result) };
3539 o.contents.result = std::ptr::null_mut();
3540 CResult_NoneMonitorUpdateErrorZPtr { result: std::ptr::null_mut() }
3542 let err = unsafe { o.contents.err };
3543 unsafe { o.contents.err = std::ptr::null_mut(); }
3544 CResult_NoneMonitorUpdateErrorZPtr { err }
3548 result_ok: o.result_ok,
3552 impl Clone for CResult_NoneMonitorUpdateErrorZ {
3553 fn clone(&self) -> Self {
3555 Self { result_ok: true, contents: CResult_NoneMonitorUpdateErrorZPtr {
3556 result: std::ptr::null_mut()
3559 Self { result_ok: false, contents: CResult_NoneMonitorUpdateErrorZPtr {
3560 err: Box::into_raw(Box::new(<crate::chain::channelmonitor::MonitorUpdateError>::clone(unsafe { &*self.contents.err })))
3566 /// Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
3567 /// but with all dynamically-allocated buffers duplicated in new buffers.
3568 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_clone(orig: &CResult_NoneMonitorUpdateErrorZ) -> CResult_NoneMonitorUpdateErrorZ { orig.clone() }
3570 /// A tuple of 2 elements. See the individual fields for the types contained.
3571 pub struct C2Tuple_OutPointScriptZ {
3572 /// The element at position 0
3573 pub a: crate::chain::transaction::OutPoint,
3574 /// The element at position 1
3575 pub b: crate::c_types::derived::CVec_u8Z,
3577 impl From<(crate::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
3578 fn from (tup: (crate::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
3585 impl C2Tuple_OutPointScriptZ {
3586 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
3590 impl Clone for C2Tuple_OutPointScriptZ {
3591 fn clone(&self) -> Self {
3599 /// Creates a new tuple which has the same data as `orig`
3600 /// but with all dynamically-allocated buffers duplicated in new buffers.
3601 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { orig.clone() }
3602 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
3604 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
3605 C2Tuple_OutPointScriptZ { a, b, }
3609 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
3610 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
3612 /// A tuple of 2 elements. See the individual fields for the types contained.
3613 pub struct C2Tuple_u32ScriptZ {
3614 /// The element at position 0
3616 /// The element at position 1
3617 pub b: crate::c_types::derived::CVec_u8Z,
3619 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
3620 fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
3627 impl C2Tuple_u32ScriptZ {
3628 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
3632 impl Clone for C2Tuple_u32ScriptZ {
3633 fn clone(&self) -> Self {
3641 /// Creates a new tuple which has the same data as `orig`
3642 /// but with all dynamically-allocated buffers duplicated in new buffers.
3643 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { orig.clone() }
3644 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
3646 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
3647 C2Tuple_u32ScriptZ { a, b, }
3651 /// Frees any resources used by the C2Tuple_u32ScriptZ.
3652 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
3654 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
3655 /// This corresponds to std::vector in C++
3656 pub struct CVec_C2Tuple_u32ScriptZZ {
3657 /// The elements in the array.
3658 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3659 pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
3660 /// The number of elements pointed to by `data`.
3663 impl CVec_C2Tuple_u32ScriptZZ {
3664 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
3665 if self.datalen == 0 { return Vec::new(); }
3666 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3667 self.data = std::ptr::null_mut();
3671 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
3672 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3675 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
3676 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
3677 let datalen = v.len();
3678 let data = Box::into_raw(v.into_boxed_slice());
3679 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3683 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3684 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
3685 impl Drop for CVec_C2Tuple_u32ScriptZZ {
3686 fn drop(&mut self) {
3687 if self.datalen == 0 { return; }
3688 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3691 impl Clone for CVec_C2Tuple_u32ScriptZZ {
3692 fn clone(&self) -> Self {
3693 let mut res = Vec::new();
3694 if self.datalen == 0 { return Self::from(res); }
3695 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3700 /// A tuple of 2 elements. See the individual fields for the types contained.
3701 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
3702 /// The element at position 0
3703 pub a: crate::c_types::ThirtyTwoBytes,
3704 /// The element at position 1
3705 pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
3707 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
3708 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
3715 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
3716 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
3720 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
3722 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 {
3723 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
3727 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
3728 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
3730 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
3731 /// This corresponds to std::vector in C++
3732 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
3733 /// The elements in the array.
3734 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3735 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
3736 /// The number of elements pointed to by `data`.
3739 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
3740 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
3741 if self.datalen == 0 { return Vec::new(); }
3742 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3743 self.data = std::ptr::null_mut();
3747 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
3748 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3751 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
3752 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
3753 let datalen = v.len();
3754 let data = Box::into_raw(v.into_boxed_slice());
3755 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3759 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3760 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
3761 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
3762 fn drop(&mut self) {
3763 if self.datalen == 0 { return; }
3764 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3768 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
3769 /// This corresponds to std::vector in C++
3770 pub struct CVec_TransactionZ {
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::Transaction,
3774 /// The number of elements pointed to by `data`.
3777 impl CVec_TransactionZ {
3778 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
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::Transaction] {
3786 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3789 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
3790 fn from(v: Vec<crate::c_types::Transaction>) -> 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_TransactionZ_free(_res: CVec_TransactionZ) { }
3799 impl Drop for CVec_TransactionZ {
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 tuple of 2 elements. See the individual fields for the types contained.
3807 pub struct C2Tuple_u32TxOutZ {
3808 /// The element at position 0
3810 /// The element at position 1
3811 pub b: crate::c_types::TxOut,
3813 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
3814 fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
3821 impl C2Tuple_u32TxOutZ {
3822 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
3826 impl Clone for C2Tuple_u32TxOutZ {
3827 fn clone(&self) -> Self {
3835 /// Creates a new tuple which has the same data as `orig`
3836 /// but with all dynamically-allocated buffers duplicated in new buffers.
3837 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { orig.clone() }
3838 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
3840 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
3841 C2Tuple_u32TxOutZ { a, b, }
3845 /// Frees any resources used by the C2Tuple_u32TxOutZ.
3846 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
3848 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
3849 /// This corresponds to std::vector in C++
3850 pub struct CVec_C2Tuple_u32TxOutZZ {
3851 /// The elements in the array.
3852 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3853 pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
3854 /// The number of elements pointed to by `data`.
3857 impl CVec_C2Tuple_u32TxOutZZ {
3858 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
3859 if self.datalen == 0 { return Vec::new(); }
3860 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3861 self.data = std::ptr::null_mut();
3865 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
3866 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3869 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
3870 fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
3871 let datalen = v.len();
3872 let data = Box::into_raw(v.into_boxed_slice());
3873 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3877 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3878 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
3879 impl Drop for CVec_C2Tuple_u32TxOutZZ {
3880 fn drop(&mut self) {
3881 if self.datalen == 0 { return; }
3882 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3885 impl Clone for CVec_C2Tuple_u32TxOutZZ {
3886 fn clone(&self) -> Self {
3887 let mut res = Vec::new();
3888 if self.datalen == 0 { return Self::from(res); }
3889 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3894 /// A tuple of 2 elements. See the individual fields for the types contained.
3895 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
3896 /// The element at position 0
3897 pub a: crate::c_types::ThirtyTwoBytes,
3898 /// The element at position 1
3899 pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
3901 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
3902 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
3909 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
3910 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
3914 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
3916 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 {
3917 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
3921 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
3922 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
3924 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
3925 /// This corresponds to std::vector in C++
3926 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ {
3927 /// The elements in the array.
3928 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3929 pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
3930 /// The number of elements pointed to by `data`.
3933 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ {
3934 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
3935 if self.datalen == 0 { return Vec::new(); }
3936 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3937 self.data = std::ptr::null_mut();
3941 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
3942 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3945 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ {
3946 fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
3947 let datalen = v.len();
3948 let data = Box::into_raw(v.into_boxed_slice());
3949 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3953 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3954 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ) { }
3955 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ {
3956 fn drop(&mut self) {
3957 if self.datalen == 0 { return; }
3958 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3962 /// A tuple of 2 elements. See the individual fields for the types contained.
3963 pub struct C2Tuple_BlockHashChannelMonitorZ {
3964 /// The element at position 0
3965 pub a: crate::c_types::ThirtyTwoBytes,
3966 /// The element at position 1
3967 pub b: crate::chain::channelmonitor::ChannelMonitor,
3969 impl From<(crate::c_types::ThirtyTwoBytes, crate::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
3970 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::chain::channelmonitor::ChannelMonitor)) -> Self {
3977 impl C2Tuple_BlockHashChannelMonitorZ {
3978 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::chain::channelmonitor::ChannelMonitor) {
3982 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
3984 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
3985 C2Tuple_BlockHashChannelMonitorZ { a, b, }
3989 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
3990 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
3992 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
3993 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
3994 /// A pointer to the contents in the success state.
3995 /// Reading from this pointer when `result_ok` is not set is undefined.
3996 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
3997 /// A pointer to the contents in the error state.
3998 /// Reading from this pointer when `result_ok` is set is undefined.
3999 pub err: *mut crate::ln::msgs::DecodeError,
4002 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
4003 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::ln::msgs::DecodeError on failure.
4004 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4005 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
4006 /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
4007 /// `err` or `result` depending on the state of `result_ok`.
4008 pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
4009 /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
4010 pub result_ok: bool,
4013 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
4014 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
4015 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
4016 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
4017 result: Box::into_raw(Box::new(o)),
4023 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
4024 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
4025 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
4026 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
4027 err: Box::into_raw(Box::new(e)),
4033 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
4034 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
4035 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
4036 fn drop(&mut self) {
4038 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4039 let _ = unsafe { Box::from_raw(self.contents.result) };
4042 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4043 let _ = unsafe { Box::from_raw(self.contents.err) };
4048 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
4049 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::ln::msgs::DecodeError>) -> Self {
4050 let contents = if o.result_ok {
4051 let result = unsafe { o.contents.result };
4052 unsafe { o.contents.result = std::ptr::null_mut() };
4053 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
4055 let err = unsafe { o.contents.err };
4056 unsafe { o.contents.err = std::ptr::null_mut(); }
4057 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
4061 result_ok: o.result_ok,
4066 /// A dynamically-allocated array of crate::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
4067 /// This corresponds to std::vector in C++
4068 pub struct CVec_SpendableOutputDescriptorZ {
4069 /// The elements in the array.
4070 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4071 pub data: *mut crate::chain::keysinterface::SpendableOutputDescriptor,
4072 /// The number of elements pointed to by `data`.
4075 impl CVec_SpendableOutputDescriptorZ {
4076 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::chain::keysinterface::SpendableOutputDescriptor> {
4077 if self.datalen == 0 { return Vec::new(); }
4078 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4079 self.data = std::ptr::null_mut();
4083 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::chain::keysinterface::SpendableOutputDescriptor] {
4084 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4087 impl From<Vec<crate::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
4088 fn from(v: Vec<crate::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
4089 let datalen = v.len();
4090 let data = Box::into_raw(v.into_boxed_slice());
4091 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4095 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4096 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
4097 impl Drop for CVec_SpendableOutputDescriptorZ {
4098 fn drop(&mut self) {
4099 if self.datalen == 0 { return; }
4100 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4103 impl Clone for CVec_SpendableOutputDescriptorZ {
4104 fn clone(&self) -> Self {
4105 let mut res = Vec::new();
4106 if self.datalen == 0 { return Self::from(res); }
4107 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4112 /// The contents of CResult_TxOutAccessErrorZ
4113 pub union CResult_TxOutAccessErrorZPtr {
4114 /// A pointer to the contents in the success state.
4115 /// Reading from this pointer when `result_ok` is not set is undefined.
4116 pub result: *mut crate::c_types::TxOut,
4117 /// A pointer to the contents in the error state.
4118 /// Reading from this pointer when `result_ok` is set is undefined.
4119 pub err: *mut crate::chain::AccessError,
4122 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
4123 /// containing a crate::c_types::TxOut on success and a crate::chain::AccessError on failure.
4124 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4125 pub struct CResult_TxOutAccessErrorZ {
4126 /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
4127 /// `err` or `result` depending on the state of `result_ok`.
4128 pub contents: CResult_TxOutAccessErrorZPtr,
4129 /// Whether this CResult_TxOutAccessErrorZ represents a success state.
4130 pub result_ok: bool,
4133 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
4134 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
4135 CResult_TxOutAccessErrorZ {
4136 contents: CResult_TxOutAccessErrorZPtr {
4137 result: Box::into_raw(Box::new(o)),
4143 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
4144 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::chain::AccessError) -> CResult_TxOutAccessErrorZ {
4145 CResult_TxOutAccessErrorZ {
4146 contents: CResult_TxOutAccessErrorZPtr {
4147 err: Box::into_raw(Box::new(e)),
4153 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
4154 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
4155 impl Drop for CResult_TxOutAccessErrorZ {
4156 fn drop(&mut self) {
4158 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4159 let _ = unsafe { Box::from_raw(self.contents.result) };
4162 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4163 let _ = unsafe { Box::from_raw(self.contents.err) };
4168 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::chain::AccessError>> for CResult_TxOutAccessErrorZ {
4169 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::chain::AccessError>) -> Self {
4170 let contents = if o.result_ok {
4171 let result = unsafe { o.contents.result };
4172 unsafe { o.contents.result = std::ptr::null_mut() };
4173 CResult_TxOutAccessErrorZPtr { result }
4175 let err = unsafe { o.contents.err };
4176 unsafe { o.contents.err = std::ptr::null_mut(); }
4177 CResult_TxOutAccessErrorZPtr { err }
4181 result_ok: o.result_ok,
4185 impl Clone for CResult_TxOutAccessErrorZ {
4186 fn clone(&self) -> Self {
4188 Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
4189 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
4192 Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
4193 err: Box::into_raw(Box::new(<crate::chain::AccessError>::clone(unsafe { &*self.contents.err })))
4199 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
4200 /// but with all dynamically-allocated buffers duplicated in new buffers.
4201 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { orig.clone() }
4203 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
4204 pub enum COption_C2Tuple_usizeTransactionZZ {
4205 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
4206 Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
4207 /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
4210 impl COption_C2Tuple_usizeTransactionZZ {
4211 #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4212 if let Self::Some(_) = self { true } else { false }
4214 #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
4215 if let Self::Some(v) = self { v } else { unreachable!() }
4219 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
4220 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
4221 COption_C2Tuple_usizeTransactionZZ::Some(o)
4224 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
4225 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
4226 COption_C2Tuple_usizeTransactionZZ::None
4229 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
4230 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
4232 /// The contents of CResult_NoneAPIErrorZ
4233 pub union CResult_NoneAPIErrorZPtr {
4234 /// Note that this value is always NULL, as there are no contents in the OK variant
4235 pub result: *mut std::ffi::c_void,
4236 /// A pointer to the contents in the error state.
4237 /// Reading from this pointer when `result_ok` is set is undefined.
4238 pub err: *mut crate::util::errors::APIError,
4241 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
4242 /// containing a () on success and a crate::util::errors::APIError on failure.
4243 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4244 pub struct CResult_NoneAPIErrorZ {
4245 /// The contents of this CResult_NoneAPIErrorZ, accessible via either
4246 /// `err` or `result` depending on the state of `result_ok`.
4247 pub contents: CResult_NoneAPIErrorZPtr,
4248 /// Whether this CResult_NoneAPIErrorZ represents a success state.
4249 pub result_ok: bool,
4252 /// Creates a new CResult_NoneAPIErrorZ in the success state.
4253 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
4254 CResult_NoneAPIErrorZ {
4255 contents: CResult_NoneAPIErrorZPtr {
4256 result: std::ptr::null_mut(),
4262 /// Creates a new CResult_NoneAPIErrorZ in the error state.
4263 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::util::errors::APIError) -> CResult_NoneAPIErrorZ {
4264 CResult_NoneAPIErrorZ {
4265 contents: CResult_NoneAPIErrorZPtr {
4266 err: Box::into_raw(Box::new(e)),
4272 /// Frees any resources used by the CResult_NoneAPIErrorZ.
4273 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
4274 impl Drop for CResult_NoneAPIErrorZ {
4275 fn drop(&mut self) {
4278 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4279 let _ = unsafe { Box::from_raw(self.contents.err) };
4284 impl From<crate::c_types::CResultTempl<u8, crate::util::errors::APIError>> for CResult_NoneAPIErrorZ {
4285 fn from(mut o: crate::c_types::CResultTempl<u8, crate::util::errors::APIError>) -> Self {
4286 let contents = if o.result_ok {
4287 let _ = unsafe { Box::from_raw(o.contents.result) };
4288 o.contents.result = std::ptr::null_mut();
4289 CResult_NoneAPIErrorZPtr { result: std::ptr::null_mut() }
4291 let err = unsafe { o.contents.err };
4292 unsafe { o.contents.err = std::ptr::null_mut(); }
4293 CResult_NoneAPIErrorZPtr { err }
4297 result_ok: o.result_ok,
4301 impl Clone for CResult_NoneAPIErrorZ {
4302 fn clone(&self) -> Self {
4304 Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
4305 result: std::ptr::null_mut()
4308 Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
4309 err: Box::into_raw(Box::new(<crate::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
4315 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
4316 /// but with all dynamically-allocated buffers duplicated in new buffers.
4317 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { orig.clone() }
4319 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
4320 /// This corresponds to std::vector in C++
4321 pub struct CVec_CResult_NoneAPIErrorZZ {
4322 /// The elements in the array.
4323 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4324 pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
4325 /// The number of elements pointed to by `data`.
4328 impl CVec_CResult_NoneAPIErrorZZ {
4329 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
4330 if self.datalen == 0 { return Vec::new(); }
4331 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4332 self.data = std::ptr::null_mut();
4336 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
4337 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4340 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
4341 fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
4342 let datalen = v.len();
4343 let data = Box::into_raw(v.into_boxed_slice());
4344 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4348 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4349 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
4350 impl Drop for CVec_CResult_NoneAPIErrorZZ {
4351 fn drop(&mut self) {
4352 if self.datalen == 0 { return; }
4353 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4356 impl Clone for CVec_CResult_NoneAPIErrorZZ {
4357 fn clone(&self) -> Self {
4358 let mut res = Vec::new();
4359 if self.datalen == 0 { return Self::from(res); }
4360 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4365 /// A dynamically-allocated array of crate::util::errors::APIErrors of arbitrary size.
4366 /// This corresponds to std::vector in C++
4367 pub struct CVec_APIErrorZ {
4368 /// The elements in the array.
4369 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4370 pub data: *mut crate::util::errors::APIError,
4371 /// The number of elements pointed to by `data`.
4374 impl CVec_APIErrorZ {
4375 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::util::errors::APIError> {
4376 if self.datalen == 0 { return Vec::new(); }
4377 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4378 self.data = std::ptr::null_mut();
4382 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::util::errors::APIError] {
4383 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4386 impl From<Vec<crate::util::errors::APIError>> for CVec_APIErrorZ {
4387 fn from(v: Vec<crate::util::errors::APIError>) -> Self {
4388 let datalen = v.len();
4389 let data = Box::into_raw(v.into_boxed_slice());
4390 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4394 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4395 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
4396 impl Drop for CVec_APIErrorZ {
4397 fn drop(&mut self) {
4398 if self.datalen == 0 { return; }
4399 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4402 impl Clone for CVec_APIErrorZ {
4403 fn clone(&self) -> Self {
4404 let mut res = Vec::new();
4405 if self.datalen == 0 { return Self::from(res); }
4406 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4411 /// A dynamically-allocated array of crate::ln::channelmanager::ChannelDetailss of arbitrary size.
4412 /// This corresponds to std::vector in C++
4413 pub struct CVec_ChannelDetailsZ {
4414 /// The elements in the array.
4415 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4416 pub data: *mut crate::ln::channelmanager::ChannelDetails,
4417 /// The number of elements pointed to by `data`.
4420 impl CVec_ChannelDetailsZ {
4421 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::channelmanager::ChannelDetails> {
4422 if self.datalen == 0 { return Vec::new(); }
4423 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4424 self.data = std::ptr::null_mut();
4428 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::channelmanager::ChannelDetails] {
4429 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4432 impl From<Vec<crate::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
4433 fn from(v: Vec<crate::ln::channelmanager::ChannelDetails>) -> Self {
4434 let datalen = v.len();
4435 let data = Box::into_raw(v.into_boxed_slice());
4436 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4440 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4441 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
4442 impl Drop for CVec_ChannelDetailsZ {
4443 fn drop(&mut self) {
4444 if self.datalen == 0 { return; }
4445 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4448 impl Clone for CVec_ChannelDetailsZ {
4449 fn clone(&self) -> Self {
4450 let mut res = Vec::new();
4451 if self.datalen == 0 { return Self::from(res); }
4452 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4457 /// The contents of CResult_NonePaymentSendFailureZ
4458 pub union CResult_NonePaymentSendFailureZPtr {
4459 /// Note that this value is always NULL, as there are no contents in the OK variant
4460 pub result: *mut std::ffi::c_void,
4461 /// A pointer to the contents in the error state.
4462 /// Reading from this pointer when `result_ok` is set is undefined.
4463 pub err: *mut crate::ln::channelmanager::PaymentSendFailure,
4466 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
4467 /// containing a () on success and a crate::ln::channelmanager::PaymentSendFailure on failure.
4468 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4469 pub struct CResult_NonePaymentSendFailureZ {
4470 /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
4471 /// `err` or `result` depending on the state of `result_ok`.
4472 pub contents: CResult_NonePaymentSendFailureZPtr,
4473 /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
4474 pub result_ok: bool,
4477 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
4478 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
4479 CResult_NonePaymentSendFailureZ {
4480 contents: CResult_NonePaymentSendFailureZPtr {
4481 result: std::ptr::null_mut(),
4487 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
4488 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
4489 CResult_NonePaymentSendFailureZ {
4490 contents: CResult_NonePaymentSendFailureZPtr {
4491 err: Box::into_raw(Box::new(e)),
4497 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
4498 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
4499 impl Drop for CResult_NonePaymentSendFailureZ {
4500 fn drop(&mut self) {
4503 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4504 let _ = unsafe { Box::from_raw(self.contents.err) };
4509 impl From<crate::c_types::CResultTempl<u8, crate::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
4510 fn from(mut o: crate::c_types::CResultTempl<u8, crate::ln::channelmanager::PaymentSendFailure>) -> Self {
4511 let contents = if o.result_ok {
4512 let _ = unsafe { Box::from_raw(o.contents.result) };
4513 o.contents.result = std::ptr::null_mut();
4514 CResult_NonePaymentSendFailureZPtr { result: std::ptr::null_mut() }
4516 let err = unsafe { o.contents.err };
4517 unsafe { o.contents.err = std::ptr::null_mut(); }
4518 CResult_NonePaymentSendFailureZPtr { err }
4522 result_ok: o.result_ok,
4526 impl Clone for CResult_NonePaymentSendFailureZ {
4527 fn clone(&self) -> Self {
4529 Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
4530 result: std::ptr::null_mut()
4533 Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
4534 err: Box::into_raw(Box::new(<crate::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
4540 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
4541 /// but with all dynamically-allocated buffers duplicated in new buffers.
4542 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { orig.clone() }
4544 /// A dynamically-allocated array of crate::chain::channelmonitor::ChannelMonitors of arbitrary size.
4545 /// This corresponds to std::vector in C++
4546 pub struct CVec_ChannelMonitorZ {
4547 /// The elements in the array.
4548 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4549 pub data: *mut crate::chain::channelmonitor::ChannelMonitor,
4550 /// The number of elements pointed to by `data`.
4553 impl CVec_ChannelMonitorZ {
4554 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::chain::channelmonitor::ChannelMonitor> {
4555 if self.datalen == 0 { return Vec::new(); }
4556 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4557 self.data = std::ptr::null_mut();
4561 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::chain::channelmonitor::ChannelMonitor] {
4562 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4565 impl From<Vec<crate::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
4566 fn from(v: Vec<crate::chain::channelmonitor::ChannelMonitor>) -> Self {
4567 let datalen = v.len();
4568 let data = Box::into_raw(v.into_boxed_slice());
4569 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4573 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4574 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
4575 impl Drop for CVec_ChannelMonitorZ {
4576 fn drop(&mut self) {
4577 if self.datalen == 0 { return; }
4578 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4582 /// A tuple of 2 elements. See the individual fields for the types contained.
4583 pub struct C2Tuple_BlockHashChannelManagerZ {
4584 /// The element at position 0
4585 pub a: crate::c_types::ThirtyTwoBytes,
4586 /// The element at position 1
4587 pub b: crate::ln::channelmanager::ChannelManager,
4589 impl From<(crate::c_types::ThirtyTwoBytes, crate::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
4590 fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::ln::channelmanager::ChannelManager)) -> Self {
4597 impl C2Tuple_BlockHashChannelManagerZ {
4598 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::ln::channelmanager::ChannelManager) {
4602 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
4604 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
4605 C2Tuple_BlockHashChannelManagerZ { a, b, }
4609 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
4610 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
4612 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
4613 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4614 /// A pointer to the contents in the success state.
4615 /// Reading from this pointer when `result_ok` is not set is undefined.
4616 pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
4617 /// A pointer to the contents in the error state.
4618 /// Reading from this pointer when `result_ok` is set is undefined.
4619 pub err: *mut crate::ln::msgs::DecodeError,
4622 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
4623 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::ln::msgs::DecodeError on failure.
4624 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4625 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4626 /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
4627 /// `err` or `result` depending on the state of `result_ok`.
4628 pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
4629 /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
4630 pub result_ok: bool,
4633 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
4634 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4635 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4636 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4637 result: Box::into_raw(Box::new(o)),
4643 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
4644 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4645 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4646 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4647 err: Box::into_raw(Box::new(e)),
4653 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
4654 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
4655 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4656 fn drop(&mut self) {
4658 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4659 let _ = unsafe { Box::from_raw(self.contents.result) };
4662 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4663 let _ = unsafe { Box::from_raw(self.contents.err) };
4668 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4669 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::ln::msgs::DecodeError>) -> Self {
4670 let contents = if o.result_ok {
4671 let result = unsafe { o.contents.result };
4672 unsafe { o.contents.result = std::ptr::null_mut() };
4673 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
4675 let err = unsafe { o.contents.err };
4676 unsafe { o.contents.err = std::ptr::null_mut(); }
4677 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
4681 result_ok: o.result_ok,
4686 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
4687 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4688 /// A pointer to the contents in the success state.
4689 /// Reading from this pointer when `result_ok` is not set is undefined.
4690 pub result: *mut crate::chain::keysinterface::SpendableOutputDescriptor,
4691 /// A pointer to the contents in the error state.
4692 /// Reading from this pointer when `result_ok` is set is undefined.
4693 pub err: *mut crate::ln::msgs::DecodeError,
4696 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4697 /// containing a crate::chain::keysinterface::SpendableOutputDescriptor on success and a crate::ln::msgs::DecodeError on failure.
4698 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4699 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
4700 /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
4701 /// `err` or `result` depending on the state of `result_ok`.
4702 pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
4703 /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
4704 pub result_ok: bool,
4707 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
4708 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4709 CResult_SpendableOutputDescriptorDecodeErrorZ {
4710 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4711 result: Box::into_raw(Box::new(o)),
4717 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
4718 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4719 CResult_SpendableOutputDescriptorDecodeErrorZ {
4720 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4721 err: Box::into_raw(Box::new(e)),
4727 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
4728 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
4729 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
4730 fn drop(&mut self) {
4732 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4733 let _ = unsafe { Box::from_raw(self.contents.result) };
4736 if unsafe { !(self.contents.err as *mut ()).is_null() } {
4737 let _ = unsafe { Box::from_raw(self.contents.err) };
4742 impl From<crate::c_types::CResultTempl<crate::chain::keysinterface::SpendableOutputDescriptor, crate::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
4743 fn from(mut o: crate::c_types::CResultTempl<crate::chain::keysinterface::SpendableOutputDescriptor, crate::ln::msgs::DecodeError>) -> Self {
4744 let contents = if o.result_ok {
4745 let result = unsafe { o.contents.result };
4746 unsafe { o.contents.result = std::ptr::null_mut() };
4747 CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
4749 let err = unsafe { o.contents.err };
4750 unsafe { o.contents.err = std::ptr::null_mut(); }
4751 CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
4755 result_ok: o.result_ok,
4759 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
4760 fn clone(&self) -> Self {
4762 Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4763 result: Box::into_raw(Box::new(<crate::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4766 Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4767 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4773 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
4774 /// but with all dynamically-allocated buffers duplicated in new buffers.
4775 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { orig.clone() }
4777 /// A tuple of 2 elements. See the individual fields for the types contained.
4778 pub struct C2Tuple_SignatureCVec_SignatureZZ {
4779 /// The element at position 0
4780 pub a: crate::c_types::Signature,
4781 /// The element at position 1
4782 pub b: crate::c_types::derived::CVec_SignatureZ,
4784 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
4785 fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
4792 impl C2Tuple_SignatureCVec_SignatureZZ {
4793 #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
4797 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
4798 fn clone(&self) -> Self {
4806 /// Creates a new tuple which has the same data as `orig`
4807 /// but with all dynamically-allocated buffers duplicated in new buffers.
4808 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { orig.clone() }
4809 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
4811 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
4812 C2Tuple_SignatureCVec_SignatureZZ { a, b, }
4816 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
4817 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
4819 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
4820 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4821 /// A pointer to the contents in the success state.
4822 /// Reading from this pointer when `result_ok` is not set is undefined.
4823 pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
4824 /// Note that this value is always NULL, as there are no contents in the Err variant
4825 pub err: *mut std::ffi::c_void,
4828 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
4829 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
4830 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4831 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4832 /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
4833 /// `err` or `result` depending on the state of `result_ok`.
4834 pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
4835 /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
4836 pub result_ok: bool,
4839 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
4840 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4841 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4842 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4843 result: Box::into_raw(Box::new(o)),
4849 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
4850 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4851 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4852 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4853 err: std::ptr::null_mut(),
4859 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
4860 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
4861 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4862 fn drop(&mut self) {
4864 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4865 let _ = unsafe { Box::from_raw(self.contents.result) };
4871 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, u8>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4872 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, u8>) -> Self {
4873 let contents = if o.result_ok {
4874 let result = unsafe { o.contents.result };
4875 unsafe { o.contents.result = std::ptr::null_mut() };
4876 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
4878 let _ = unsafe { Box::from_raw(o.contents.err) };
4879 o.contents.err = std::ptr::null_mut();
4880 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: std::ptr::null_mut() }
4884 result_ok: o.result_ok,
4888 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4889 fn clone(&self) -> Self {
4891 Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4892 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
4895 Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4896 err: std::ptr::null_mut()
4902 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
4903 /// but with all dynamically-allocated buffers duplicated in new buffers.
4904 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { orig.clone() }
4906 /// The contents of CResult_SignatureNoneZ
4907 pub union CResult_SignatureNoneZPtr {
4908 /// A pointer to the contents in the success state.
4909 /// Reading from this pointer when `result_ok` is not set is undefined.
4910 pub result: *mut crate::c_types::Signature,
4911 /// Note that this value is always NULL, as there are no contents in the Err variant
4912 pub err: *mut std::ffi::c_void,
4915 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
4916 /// containing a crate::c_types::Signature on success and a () on failure.
4917 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4918 pub struct CResult_SignatureNoneZ {
4919 /// The contents of this CResult_SignatureNoneZ, accessible via either
4920 /// `err` or `result` depending on the state of `result_ok`.
4921 pub contents: CResult_SignatureNoneZPtr,
4922 /// Whether this CResult_SignatureNoneZ represents a success state.
4923 pub result_ok: bool,
4926 /// Creates a new CResult_SignatureNoneZ in the success state.
4927 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
4928 CResult_SignatureNoneZ {
4929 contents: CResult_SignatureNoneZPtr {
4930 result: Box::into_raw(Box::new(o)),
4936 /// Creates a new CResult_SignatureNoneZ in the error state.
4937 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
4938 CResult_SignatureNoneZ {
4939 contents: CResult_SignatureNoneZPtr {
4940 err: std::ptr::null_mut(),
4946 /// Frees any resources used by the CResult_SignatureNoneZ.
4947 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
4948 impl Drop for CResult_SignatureNoneZ {
4949 fn drop(&mut self) {
4951 if unsafe { !(self.contents.result as *mut ()).is_null() } {
4952 let _ = unsafe { Box::from_raw(self.contents.result) };
4958 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, u8>> for CResult_SignatureNoneZ {
4959 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, u8>) -> Self {
4960 let contents = if o.result_ok {
4961 let result = unsafe { o.contents.result };
4962 unsafe { o.contents.result = std::ptr::null_mut() };
4963 CResult_SignatureNoneZPtr { result }
4965 let _ = unsafe { Box::from_raw(o.contents.err) };
4966 o.contents.err = std::ptr::null_mut();
4967 CResult_SignatureNoneZPtr { err: std::ptr::null_mut() }
4971 result_ok: o.result_ok,
4975 impl Clone for CResult_SignatureNoneZ {
4976 fn clone(&self) -> Self {
4978 Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
4979 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
4982 Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
4983 err: std::ptr::null_mut()
4989 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
4990 /// but with all dynamically-allocated buffers duplicated in new buffers.
4991 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { orig.clone() }
4993 /// The contents of CResult_SignDecodeErrorZ
4994 pub union CResult_SignDecodeErrorZPtr {
4995 /// A pointer to the contents in the success state.
4996 /// Reading from this pointer when `result_ok` is not set is undefined.
4997 pub result: *mut crate::chain::keysinterface::Sign,
4998 /// A pointer to the contents in the error state.
4999 /// Reading from this pointer when `result_ok` is set is undefined.
5000 pub err: *mut crate::ln::msgs::DecodeError,
5003 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
5004 /// containing a crate::chain::keysinterface::Sign on success and a crate::ln::msgs::DecodeError on failure.
5005 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5006 pub struct CResult_SignDecodeErrorZ {
5007 /// The contents of this CResult_SignDecodeErrorZ, accessible via either
5008 /// `err` or `result` depending on the state of `result_ok`.
5009 pub contents: CResult_SignDecodeErrorZPtr,
5010 /// Whether this CResult_SignDecodeErrorZ represents a success state.
5011 pub result_ok: bool,
5014 /// Creates a new CResult_SignDecodeErrorZ in the success state.
5015 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
5016 CResult_SignDecodeErrorZ {
5017 contents: CResult_SignDecodeErrorZPtr {
5018 result: Box::into_raw(Box::new(o)),
5024 /// Creates a new CResult_SignDecodeErrorZ in the error state.
5025 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
5026 CResult_SignDecodeErrorZ {
5027 contents: CResult_SignDecodeErrorZPtr {
5028 err: Box::into_raw(Box::new(e)),
5034 /// Frees any resources used by the CResult_SignDecodeErrorZ.
5035 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
5036 impl Drop for CResult_SignDecodeErrorZ {
5037 fn drop(&mut self) {
5039 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5040 let _ = unsafe { Box::from_raw(self.contents.result) };
5043 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5044 let _ = unsafe { Box::from_raw(self.contents.err) };
5049 impl From<crate::c_types::CResultTempl<crate::chain::keysinterface::Sign, crate::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
5050 fn from(mut o: crate::c_types::CResultTempl<crate::chain::keysinterface::Sign, crate::ln::msgs::DecodeError>) -> Self {
5051 let contents = if o.result_ok {
5052 let result = unsafe { o.contents.result };
5053 unsafe { o.contents.result = std::ptr::null_mut() };
5054 CResult_SignDecodeErrorZPtr { result }
5056 let err = unsafe { o.contents.err };
5057 unsafe { o.contents.err = std::ptr::null_mut(); }
5058 CResult_SignDecodeErrorZPtr { err }
5062 result_ok: o.result_ok,
5066 impl Clone for CResult_SignDecodeErrorZ {
5067 fn clone(&self) -> Self {
5069 Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
5070 result: Box::into_raw(Box::new(<crate::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
5073 Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
5074 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5080 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
5081 /// but with all dynamically-allocated buffers duplicated in new buffers.
5082 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { orig.clone() }
5084 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
5085 /// This corresponds to std::vector in C++
5086 pub struct CVec_CVec_u8ZZ {
5087 /// The elements in the array.
5088 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5089 pub data: *mut crate::c_types::derived::CVec_u8Z,
5090 /// The number of elements pointed to by `data`.
5093 impl CVec_CVec_u8ZZ {
5094 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
5095 if self.datalen == 0 { return Vec::new(); }
5096 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5097 self.data = std::ptr::null_mut();
5101 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
5102 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5105 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
5106 fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
5107 let datalen = v.len();
5108 let data = Box::into_raw(v.into_boxed_slice());
5109 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5113 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5114 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
5115 impl Drop for CVec_CVec_u8ZZ {
5116 fn drop(&mut self) {
5117 if self.datalen == 0 { return; }
5118 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5121 impl Clone for CVec_CVec_u8ZZ {
5122 fn clone(&self) -> Self {
5123 let mut res = Vec::new();
5124 if self.datalen == 0 { return Self::from(res); }
5125 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5130 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
5131 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
5132 /// A pointer to the contents in the success state.
5133 /// Reading from this pointer when `result_ok` is not set is undefined.
5134 pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
5135 /// Note that this value is always NULL, as there are no contents in the Err variant
5136 pub err: *mut std::ffi::c_void,
5139 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
5140 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
5141 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5142 pub struct CResult_CVec_CVec_u8ZZNoneZ {
5143 /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
5144 /// `err` or `result` depending on the state of `result_ok`.
5145 pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
5146 /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
5147 pub result_ok: bool,
5150 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
5151 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
5152 CResult_CVec_CVec_u8ZZNoneZ {
5153 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5154 result: Box::into_raw(Box::new(o)),
5160 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
5161 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
5162 CResult_CVec_CVec_u8ZZNoneZ {
5163 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5164 err: std::ptr::null_mut(),
5170 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
5171 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
5172 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
5173 fn drop(&mut self) {
5175 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5176 let _ = unsafe { Box::from_raw(self.contents.result) };
5182 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, u8>> for CResult_CVec_CVec_u8ZZNoneZ {
5183 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, u8>) -> Self {
5184 let contents = if o.result_ok {
5185 let result = unsafe { o.contents.result };
5186 unsafe { o.contents.result = std::ptr::null_mut() };
5187 CResult_CVec_CVec_u8ZZNoneZPtr { result }
5189 let _ = unsafe { Box::from_raw(o.contents.err) };
5190 o.contents.err = std::ptr::null_mut();
5191 CResult_CVec_CVec_u8ZZNoneZPtr { err: std::ptr::null_mut() }
5195 result_ok: o.result_ok,
5199 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
5200 fn clone(&self) -> Self {
5202 Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5203 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
5206 Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5207 err: std::ptr::null_mut()
5213 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
5214 /// but with all dynamically-allocated buffers duplicated in new buffers.
5215 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { orig.clone() }
5217 /// The contents of CResult_InMemorySignerDecodeErrorZ
5218 pub union CResult_InMemorySignerDecodeErrorZPtr {
5219 /// A pointer to the contents in the success state.
5220 /// Reading from this pointer when `result_ok` is not set is undefined.
5221 pub result: *mut crate::chain::keysinterface::InMemorySigner,
5222 /// A pointer to the contents in the error state.
5223 /// Reading from this pointer when `result_ok` is set is undefined.
5224 pub err: *mut crate::ln::msgs::DecodeError,
5227 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
5228 /// containing a crate::chain::keysinterface::InMemorySigner on success and a crate::ln::msgs::DecodeError on failure.
5229 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5230 pub struct CResult_InMemorySignerDecodeErrorZ {
5231 /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
5232 /// `err` or `result` depending on the state of `result_ok`.
5233 pub contents: CResult_InMemorySignerDecodeErrorZPtr,
5234 /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
5235 pub result_ok: bool,
5238 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
5239 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
5240 CResult_InMemorySignerDecodeErrorZ {
5241 contents: CResult_InMemorySignerDecodeErrorZPtr {
5242 result: Box::into_raw(Box::new(o)),
5248 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
5249 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
5250 CResult_InMemorySignerDecodeErrorZ {
5251 contents: CResult_InMemorySignerDecodeErrorZPtr {
5252 err: Box::into_raw(Box::new(e)),
5258 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
5259 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
5260 impl Drop for CResult_InMemorySignerDecodeErrorZ {
5261 fn drop(&mut self) {
5263 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5264 let _ = unsafe { Box::from_raw(self.contents.result) };
5267 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5268 let _ = unsafe { Box::from_raw(self.contents.err) };
5273 impl From<crate::c_types::CResultTempl<crate::chain::keysinterface::InMemorySigner, crate::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
5274 fn from(mut o: crate::c_types::CResultTempl<crate::chain::keysinterface::InMemorySigner, crate::ln::msgs::DecodeError>) -> Self {
5275 let contents = if o.result_ok {
5276 let result = unsafe { o.contents.result };
5277 unsafe { o.contents.result = std::ptr::null_mut() };
5278 CResult_InMemorySignerDecodeErrorZPtr { result }
5280 let err = unsafe { o.contents.err };
5281 unsafe { o.contents.err = std::ptr::null_mut(); }
5282 CResult_InMemorySignerDecodeErrorZPtr { err }
5286 result_ok: o.result_ok,
5290 impl Clone for CResult_InMemorySignerDecodeErrorZ {
5291 fn clone(&self) -> Self {
5293 Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
5294 result: Box::into_raw(Box::new(<crate::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
5297 Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
5298 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5304 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
5305 /// but with all dynamically-allocated buffers duplicated in new buffers.
5306 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { orig.clone() }
5308 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
5309 /// This corresponds to std::vector in C++
5310 pub struct CVec_TxOutZ {
5311 /// The elements in the array.
5312 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5313 pub data: *mut crate::c_types::TxOut,
5314 /// The number of elements pointed to by `data`.
5318 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
5319 if self.datalen == 0 { return Vec::new(); }
5320 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5321 self.data = std::ptr::null_mut();
5325 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
5326 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5329 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
5330 fn from(v: Vec<crate::c_types::TxOut>) -> Self {
5331 let datalen = v.len();
5332 let data = Box::into_raw(v.into_boxed_slice());
5333 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5337 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5338 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
5339 impl Drop for CVec_TxOutZ {
5340 fn drop(&mut self) {
5341 if self.datalen == 0 { return; }
5342 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5345 impl Clone for CVec_TxOutZ {
5346 fn clone(&self) -> Self {
5347 let mut res = Vec::new();
5348 if self.datalen == 0 { return Self::from(res); }
5349 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5354 /// The contents of CResult_TransactionNoneZ
5355 pub union CResult_TransactionNoneZPtr {
5356 /// A pointer to the contents in the success state.
5357 /// Reading from this pointer when `result_ok` is not set is undefined.
5358 pub result: *mut crate::c_types::Transaction,
5359 /// Note that this value is always NULL, as there are no contents in the Err variant
5360 pub err: *mut std::ffi::c_void,
5363 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
5364 /// containing a crate::c_types::Transaction on success and a () on failure.
5365 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5366 pub struct CResult_TransactionNoneZ {
5367 /// The contents of this CResult_TransactionNoneZ, accessible via either
5368 /// `err` or `result` depending on the state of `result_ok`.
5369 pub contents: CResult_TransactionNoneZPtr,
5370 /// Whether this CResult_TransactionNoneZ represents a success state.
5371 pub result_ok: bool,
5374 /// Creates a new CResult_TransactionNoneZ in the success state.
5375 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
5376 CResult_TransactionNoneZ {
5377 contents: CResult_TransactionNoneZPtr {
5378 result: Box::into_raw(Box::new(o)),
5384 /// Creates a new CResult_TransactionNoneZ in the error state.
5385 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
5386 CResult_TransactionNoneZ {
5387 contents: CResult_TransactionNoneZPtr {
5388 err: std::ptr::null_mut(),
5394 /// Frees any resources used by the CResult_TransactionNoneZ.
5395 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
5396 impl Drop for CResult_TransactionNoneZ {
5397 fn drop(&mut self) {
5399 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5400 let _ = unsafe { Box::from_raw(self.contents.result) };
5406 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, u8>> for CResult_TransactionNoneZ {
5407 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, u8>) -> Self {
5408 let contents = if o.result_ok {
5409 let result = unsafe { o.contents.result };
5410 unsafe { o.contents.result = std::ptr::null_mut() };
5411 CResult_TransactionNoneZPtr { result }
5413 let _ = unsafe { Box::from_raw(o.contents.err) };
5414 o.contents.err = std::ptr::null_mut();
5415 CResult_TransactionNoneZPtr { err: std::ptr::null_mut() }
5419 result_ok: o.result_ok,
5424 /// A dynamically-allocated array of crate::routing::router::RouteHops of arbitrary size.
5425 /// This corresponds to std::vector in C++
5426 pub struct CVec_RouteHopZ {
5427 /// The elements in the array.
5428 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5429 pub data: *mut crate::routing::router::RouteHop,
5430 /// The number of elements pointed to by `data`.
5433 impl CVec_RouteHopZ {
5434 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::routing::router::RouteHop> {
5435 if self.datalen == 0 { return Vec::new(); }
5436 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5437 self.data = std::ptr::null_mut();
5441 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::routing::router::RouteHop] {
5442 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5445 impl From<Vec<crate::routing::router::RouteHop>> for CVec_RouteHopZ {
5446 fn from(v: Vec<crate::routing::router::RouteHop>) -> Self {
5447 let datalen = v.len();
5448 let data = Box::into_raw(v.into_boxed_slice());
5449 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5453 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5454 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
5455 impl Drop for CVec_RouteHopZ {
5456 fn drop(&mut self) {
5457 if self.datalen == 0 { return; }
5458 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5461 impl Clone for CVec_RouteHopZ {
5462 fn clone(&self) -> Self {
5463 let mut res = Vec::new();
5464 if self.datalen == 0 { return Self::from(res); }
5465 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5470 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
5471 /// This corresponds to std::vector in C++
5472 pub struct CVec_CVec_RouteHopZZ {
5473 /// The elements in the array.
5474 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5475 pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
5476 /// The number of elements pointed to by `data`.
5479 impl CVec_CVec_RouteHopZZ {
5480 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
5481 if self.datalen == 0 { return Vec::new(); }
5482 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5483 self.data = std::ptr::null_mut();
5487 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
5488 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5491 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
5492 fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
5493 let datalen = v.len();
5494 let data = Box::into_raw(v.into_boxed_slice());
5495 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5499 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5500 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
5501 impl Drop for CVec_CVec_RouteHopZZ {
5502 fn drop(&mut self) {
5503 if self.datalen == 0 { return; }
5504 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5507 impl Clone for CVec_CVec_RouteHopZZ {
5508 fn clone(&self) -> Self {
5509 let mut res = Vec::new();
5510 if self.datalen == 0 { return Self::from(res); }
5511 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5516 /// The contents of CResult_RouteDecodeErrorZ
5517 pub union CResult_RouteDecodeErrorZPtr {
5518 /// A pointer to the contents in the success state.
5519 /// Reading from this pointer when `result_ok` is not set is undefined.
5520 pub result: *mut crate::routing::router::Route,
5521 /// A pointer to the contents in the error state.
5522 /// Reading from this pointer when `result_ok` is set is undefined.
5523 pub err: *mut crate::ln::msgs::DecodeError,
5526 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
5527 /// containing a crate::routing::router::Route on success and a crate::ln::msgs::DecodeError on failure.
5528 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5529 pub struct CResult_RouteDecodeErrorZ {
5530 /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
5531 /// `err` or `result` depending on the state of `result_ok`.
5532 pub contents: CResult_RouteDecodeErrorZPtr,
5533 /// Whether this CResult_RouteDecodeErrorZ represents a success state.
5534 pub result_ok: bool,
5537 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
5538 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::routing::router::Route) -> CResult_RouteDecodeErrorZ {
5539 CResult_RouteDecodeErrorZ {
5540 contents: CResult_RouteDecodeErrorZPtr {
5541 result: Box::into_raw(Box::new(o)),
5547 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
5548 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
5549 CResult_RouteDecodeErrorZ {
5550 contents: CResult_RouteDecodeErrorZPtr {
5551 err: Box::into_raw(Box::new(e)),
5557 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
5558 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
5559 impl Drop for CResult_RouteDecodeErrorZ {
5560 fn drop(&mut self) {
5562 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5563 let _ = unsafe { Box::from_raw(self.contents.result) };
5566 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5567 let _ = unsafe { Box::from_raw(self.contents.err) };
5572 impl From<crate::c_types::CResultTempl<crate::routing::router::Route, crate::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
5573 fn from(mut o: crate::c_types::CResultTempl<crate::routing::router::Route, crate::ln::msgs::DecodeError>) -> Self {
5574 let contents = if o.result_ok {
5575 let result = unsafe { o.contents.result };
5576 unsafe { o.contents.result = std::ptr::null_mut() };
5577 CResult_RouteDecodeErrorZPtr { result }
5579 let err = unsafe { o.contents.err };
5580 unsafe { o.contents.err = std::ptr::null_mut(); }
5581 CResult_RouteDecodeErrorZPtr { err }
5585 result_ok: o.result_ok,
5589 impl Clone for CResult_RouteDecodeErrorZ {
5590 fn clone(&self) -> Self {
5592 Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
5593 result: Box::into_raw(Box::new(<crate::routing::router::Route>::clone(unsafe { &*self.contents.result })))
5596 Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
5597 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5603 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
5604 /// but with all dynamically-allocated buffers duplicated in new buffers.
5605 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { orig.clone() }
5607 /// A dynamically-allocated array of crate::routing::router::RouteHints of arbitrary size.
5608 /// This corresponds to std::vector in C++
5609 pub struct CVec_RouteHintZ {
5610 /// The elements in the array.
5611 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5612 pub data: *mut crate::routing::router::RouteHint,
5613 /// The number of elements pointed to by `data`.
5616 impl CVec_RouteHintZ {
5617 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::routing::router::RouteHint> {
5618 if self.datalen == 0 { return Vec::new(); }
5619 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5620 self.data = std::ptr::null_mut();
5624 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::routing::router::RouteHint] {
5625 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5628 impl From<Vec<crate::routing::router::RouteHint>> for CVec_RouteHintZ {
5629 fn from(v: Vec<crate::routing::router::RouteHint>) -> Self {
5630 let datalen = v.len();
5631 let data = Box::into_raw(v.into_boxed_slice());
5632 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5636 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5637 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
5638 impl Drop for CVec_RouteHintZ {
5639 fn drop(&mut self) {
5640 if self.datalen == 0 { return; }
5641 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5644 impl Clone for CVec_RouteHintZ {
5645 fn clone(&self) -> Self {
5646 let mut res = Vec::new();
5647 if self.datalen == 0 { return Self::from(res); }
5648 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5653 /// The contents of CResult_RouteLightningErrorZ
5654 pub union CResult_RouteLightningErrorZPtr {
5655 /// A pointer to the contents in the success state.
5656 /// Reading from this pointer when `result_ok` is not set is undefined.
5657 pub result: *mut crate::routing::router::Route,
5658 /// A pointer to the contents in the error state.
5659 /// Reading from this pointer when `result_ok` is set is undefined.
5660 pub err: *mut crate::ln::msgs::LightningError,
5663 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
5664 /// containing a crate::routing::router::Route on success and a crate::ln::msgs::LightningError on failure.
5665 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5666 pub struct CResult_RouteLightningErrorZ {
5667 /// The contents of this CResult_RouteLightningErrorZ, accessible via either
5668 /// `err` or `result` depending on the state of `result_ok`.
5669 pub contents: CResult_RouteLightningErrorZPtr,
5670 /// Whether this CResult_RouteLightningErrorZ represents a success state.
5671 pub result_ok: bool,
5674 /// Creates a new CResult_RouteLightningErrorZ in the success state.
5675 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::routing::router::Route) -> CResult_RouteLightningErrorZ {
5676 CResult_RouteLightningErrorZ {
5677 contents: CResult_RouteLightningErrorZPtr {
5678 result: Box::into_raw(Box::new(o)),
5684 /// Creates a new CResult_RouteLightningErrorZ in the error state.
5685 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
5686 CResult_RouteLightningErrorZ {
5687 contents: CResult_RouteLightningErrorZPtr {
5688 err: Box::into_raw(Box::new(e)),
5694 /// Frees any resources used by the CResult_RouteLightningErrorZ.
5695 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
5696 impl Drop for CResult_RouteLightningErrorZ {
5697 fn drop(&mut self) {
5699 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5700 let _ = unsafe { Box::from_raw(self.contents.result) };
5703 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5704 let _ = unsafe { Box::from_raw(self.contents.err) };
5709 impl From<crate::c_types::CResultTempl<crate::routing::router::Route, crate::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
5710 fn from(mut o: crate::c_types::CResultTempl<crate::routing::router::Route, crate::ln::msgs::LightningError>) -> Self {
5711 let contents = if o.result_ok {
5712 let result = unsafe { o.contents.result };
5713 unsafe { o.contents.result = std::ptr::null_mut() };
5714 CResult_RouteLightningErrorZPtr { result }
5716 let err = unsafe { o.contents.err };
5717 unsafe { o.contents.err = std::ptr::null_mut(); }
5718 CResult_RouteLightningErrorZPtr { err }
5722 result_ok: o.result_ok,
5726 impl Clone for CResult_RouteLightningErrorZ {
5727 fn clone(&self) -> Self {
5729 Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
5730 result: Box::into_raw(Box::new(<crate::routing::router::Route>::clone(unsafe { &*self.contents.result })))
5733 Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
5734 err: Box::into_raw(Box::new(<crate::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
5740 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
5741 /// but with all dynamically-allocated buffers duplicated in new buffers.
5742 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { orig.clone() }
5744 /// The contents of CResult_NetAddressu8Z
5745 pub union CResult_NetAddressu8ZPtr {
5746 /// A pointer to the contents in the success state.
5747 /// Reading from this pointer when `result_ok` is not set is undefined.
5748 pub result: *mut crate::ln::msgs::NetAddress,
5749 /// A pointer to the contents in the error state.
5750 /// Reading from this pointer when `result_ok` is set is undefined.
5754 /// A CResult_NetAddressu8Z represents the result of a fallible operation,
5755 /// containing a crate::ln::msgs::NetAddress on success and a u8 on failure.
5756 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5757 pub struct CResult_NetAddressu8Z {
5758 /// The contents of this CResult_NetAddressu8Z, accessible via either
5759 /// `err` or `result` depending on the state of `result_ok`.
5760 pub contents: CResult_NetAddressu8ZPtr,
5761 /// Whether this CResult_NetAddressu8Z represents a success state.
5762 pub result_ok: bool,
5765 /// Creates a new CResult_NetAddressu8Z in the success state.
5766 pub extern "C" fn CResult_NetAddressu8Z_ok(o: crate::ln::msgs::NetAddress) -> CResult_NetAddressu8Z {
5767 CResult_NetAddressu8Z {
5768 contents: CResult_NetAddressu8ZPtr {
5769 result: Box::into_raw(Box::new(o)),
5775 /// Creates a new CResult_NetAddressu8Z in the error state.
5776 pub extern "C" fn CResult_NetAddressu8Z_err(e: u8) -> CResult_NetAddressu8Z {
5777 CResult_NetAddressu8Z {
5778 contents: CResult_NetAddressu8ZPtr {
5779 err: Box::into_raw(Box::new(e)),
5785 /// Frees any resources used by the CResult_NetAddressu8Z.
5786 pub extern "C" fn CResult_NetAddressu8Z_free(_res: CResult_NetAddressu8Z) { }
5787 impl Drop for CResult_NetAddressu8Z {
5788 fn drop(&mut self) {
5790 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5791 let _ = unsafe { Box::from_raw(self.contents.result) };
5794 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5795 let _ = unsafe { Box::from_raw(self.contents.err) };
5800 impl From<crate::c_types::CResultTempl<crate::ln::msgs::NetAddress, u8>> for CResult_NetAddressu8Z {
5801 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::NetAddress, u8>) -> Self {
5802 let contents = if o.result_ok {
5803 let result = unsafe { o.contents.result };
5804 unsafe { o.contents.result = std::ptr::null_mut() };
5805 CResult_NetAddressu8ZPtr { result }
5807 let err = unsafe { o.contents.err };
5808 unsafe { o.contents.err = std::ptr::null_mut(); }
5809 CResult_NetAddressu8ZPtr { err }
5813 result_ok: o.result_ok,
5817 impl Clone for CResult_NetAddressu8Z {
5818 fn clone(&self) -> Self {
5820 Self { result_ok: true, contents: CResult_NetAddressu8ZPtr {
5821 result: Box::into_raw(Box::new(<crate::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
5824 Self { result_ok: false, contents: CResult_NetAddressu8ZPtr {
5825 err: Box::into_raw(Box::new(<u8>::clone(unsafe { &*self.contents.err })))
5831 /// Creates a new CResult_NetAddressu8Z which has the same data as `orig`
5832 /// but with all dynamically-allocated buffers duplicated in new buffers.
5833 pub extern "C" fn CResult_NetAddressu8Z_clone(orig: &CResult_NetAddressu8Z) -> CResult_NetAddressu8Z { orig.clone() }
5835 /// The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
5836 pub union CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5837 /// A pointer to the contents in the success state.
5838 /// Reading from this pointer when `result_ok` is not set is undefined.
5839 pub result: *mut crate::c_types::derived::CResult_NetAddressu8Z,
5840 /// A pointer to the contents in the error state.
5841 /// Reading from this pointer when `result_ok` is set is undefined.
5842 pub err: *mut crate::ln::msgs::DecodeError,
5845 /// A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
5846 /// containing a crate::c_types::derived::CResult_NetAddressu8Z on success and a crate::ln::msgs::DecodeError on failure.
5847 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5848 pub struct CResult_CResult_NetAddressu8ZDecodeErrorZ {
5849 /// The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
5850 /// `err` or `result` depending on the state of `result_ok`.
5851 pub contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr,
5852 /// Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
5853 pub result_ok: bool,
5856 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
5857 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o: crate::c_types::derived::CResult_NetAddressu8Z) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
5858 CResult_CResult_NetAddressu8ZDecodeErrorZ {
5859 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5860 result: Box::into_raw(Box::new(o)),
5866 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
5867 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
5868 CResult_CResult_NetAddressu8ZDecodeErrorZ {
5869 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5870 err: Box::into_raw(Box::new(e)),
5876 /// Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
5877 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res: CResult_CResult_NetAddressu8ZDecodeErrorZ) { }
5878 impl Drop for CResult_CResult_NetAddressu8ZDecodeErrorZ {
5879 fn drop(&mut self) {
5881 if unsafe { !(self.contents.result as *mut ()).is_null() } {
5882 let _ = unsafe { Box::from_raw(self.contents.result) };
5885 if unsafe { !(self.contents.err as *mut ()).is_null() } {
5886 let _ = unsafe { Box::from_raw(self.contents.err) };
5891 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::ln::msgs::DecodeError>> for CResult_CResult_NetAddressu8ZDecodeErrorZ {
5892 fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::ln::msgs::DecodeError>) -> Self {
5893 let contents = if o.result_ok {
5894 let result = unsafe { o.contents.result };
5895 unsafe { o.contents.result = std::ptr::null_mut() };
5896 CResult_CResult_NetAddressu8ZDecodeErrorZPtr { result }
5898 let err = unsafe { o.contents.err };
5899 unsafe { o.contents.err = std::ptr::null_mut(); }
5900 CResult_CResult_NetAddressu8ZDecodeErrorZPtr { err }
5904 result_ok: o.result_ok,
5908 impl Clone for CResult_CResult_NetAddressu8ZDecodeErrorZ {
5909 fn clone(&self) -> Self {
5911 Self { result_ok: true, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5912 result: Box::into_raw(Box::new(<crate::c_types::derived::CResult_NetAddressu8Z>::clone(unsafe { &*self.contents.result })))
5915 Self { result_ok: false, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
5916 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5922 /// Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
5923 /// but with all dynamically-allocated buffers duplicated in new buffers.
5924 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig: &CResult_CResult_NetAddressu8ZDecodeErrorZ) -> CResult_CResult_NetAddressu8ZDecodeErrorZ { orig.clone() }
5926 /// A dynamically-allocated array of crate::ln::msgs::UpdateAddHTLCs of arbitrary size.
5927 /// This corresponds to std::vector in C++
5928 pub struct CVec_UpdateAddHTLCZ {
5929 /// The elements in the array.
5930 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5931 pub data: *mut crate::ln::msgs::UpdateAddHTLC,
5932 /// The number of elements pointed to by `data`.
5935 impl CVec_UpdateAddHTLCZ {
5936 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::UpdateAddHTLC> {
5937 if self.datalen == 0 { return Vec::new(); }
5938 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5939 self.data = std::ptr::null_mut();
5943 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::UpdateAddHTLC] {
5944 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5947 impl From<Vec<crate::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
5948 fn from(v: Vec<crate::ln::msgs::UpdateAddHTLC>) -> Self {
5949 let datalen = v.len();
5950 let data = Box::into_raw(v.into_boxed_slice());
5951 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5955 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5956 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
5957 impl Drop for CVec_UpdateAddHTLCZ {
5958 fn drop(&mut self) {
5959 if self.datalen == 0 { return; }
5960 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5963 impl Clone for CVec_UpdateAddHTLCZ {
5964 fn clone(&self) -> Self {
5965 let mut res = Vec::new();
5966 if self.datalen == 0 { return Self::from(res); }
5967 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5972 /// A dynamically-allocated array of crate::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
5973 /// This corresponds to std::vector in C++
5974 pub struct CVec_UpdateFulfillHTLCZ {
5975 /// The elements in the array.
5976 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5977 pub data: *mut crate::ln::msgs::UpdateFulfillHTLC,
5978 /// The number of elements pointed to by `data`.
5981 impl CVec_UpdateFulfillHTLCZ {
5982 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::UpdateFulfillHTLC> {
5983 if self.datalen == 0 { return Vec::new(); }
5984 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5985 self.data = std::ptr::null_mut();
5989 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::UpdateFulfillHTLC] {
5990 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5993 impl From<Vec<crate::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
5994 fn from(v: Vec<crate::ln::msgs::UpdateFulfillHTLC>) -> Self {
5995 let datalen = v.len();
5996 let data = Box::into_raw(v.into_boxed_slice());
5997 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6001 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6002 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
6003 impl Drop for CVec_UpdateFulfillHTLCZ {
6004 fn drop(&mut self) {
6005 if self.datalen == 0 { return; }
6006 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6009 impl Clone for CVec_UpdateFulfillHTLCZ {
6010 fn clone(&self) -> Self {
6011 let mut res = Vec::new();
6012 if self.datalen == 0 { return Self::from(res); }
6013 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6018 /// A dynamically-allocated array of crate::ln::msgs::UpdateFailHTLCs of arbitrary size.
6019 /// This corresponds to std::vector in C++
6020 pub struct CVec_UpdateFailHTLCZ {
6021 /// The elements in the array.
6022 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6023 pub data: *mut crate::ln::msgs::UpdateFailHTLC,
6024 /// The number of elements pointed to by `data`.
6027 impl CVec_UpdateFailHTLCZ {
6028 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::UpdateFailHTLC> {
6029 if self.datalen == 0 { return Vec::new(); }
6030 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6031 self.data = std::ptr::null_mut();
6035 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::UpdateFailHTLC] {
6036 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6039 impl From<Vec<crate::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
6040 fn from(v: Vec<crate::ln::msgs::UpdateFailHTLC>) -> Self {
6041 let datalen = v.len();
6042 let data = Box::into_raw(v.into_boxed_slice());
6043 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6047 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6048 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
6049 impl Drop for CVec_UpdateFailHTLCZ {
6050 fn drop(&mut self) {
6051 if self.datalen == 0 { return; }
6052 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6055 impl Clone for CVec_UpdateFailHTLCZ {
6056 fn clone(&self) -> Self {
6057 let mut res = Vec::new();
6058 if self.datalen == 0 { return Self::from(res); }
6059 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6064 /// A dynamically-allocated array of crate::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
6065 /// This corresponds to std::vector in C++
6066 pub struct CVec_UpdateFailMalformedHTLCZ {
6067 /// The elements in the array.
6068 /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6069 pub data: *mut crate::ln::msgs::UpdateFailMalformedHTLC,
6070 /// The number of elements pointed to by `data`.
6073 impl CVec_UpdateFailMalformedHTLCZ {
6074 #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::UpdateFailMalformedHTLC> {
6075 if self.datalen == 0 { return Vec::new(); }
6076 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6077 self.data = std::ptr::null_mut();
6081 #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::UpdateFailMalformedHTLC] {
6082 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
6085 impl From<Vec<crate::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
6086 fn from(v: Vec<crate::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
6087 let datalen = v.len();
6088 let data = Box::into_raw(v.into_boxed_slice());
6089 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6093 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6094 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
6095 impl Drop for CVec_UpdateFailMalformedHTLCZ {
6096 fn drop(&mut self) {
6097 if self.datalen == 0 { return; }
6098 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
6101 impl Clone for CVec_UpdateFailMalformedHTLCZ {
6102 fn clone(&self) -> Self {
6103 let mut res = Vec::new();
6104 if self.datalen == 0 { return Self::from(res); }
6105 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
6110 /// The contents of CResult_AcceptChannelDecodeErrorZ
6111 pub union CResult_AcceptChannelDecodeErrorZPtr {
6112 /// A pointer to the contents in the success state.
6113 /// Reading from this pointer when `result_ok` is not set is undefined.
6114 pub result: *mut crate::ln::msgs::AcceptChannel,
6115 /// A pointer to the contents in the error state.
6116 /// Reading from this pointer when `result_ok` is set is undefined.
6117 pub err: *mut crate::ln::msgs::DecodeError,
6120 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
6121 /// containing a crate::ln::msgs::AcceptChannel on success and a crate::ln::msgs::DecodeError on failure.
6122 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6123 pub struct CResult_AcceptChannelDecodeErrorZ {
6124 /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
6125 /// `err` or `result` depending on the state of `result_ok`.
6126 pub contents: CResult_AcceptChannelDecodeErrorZPtr,
6127 /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
6128 pub result_ok: bool,
6131 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
6132 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
6133 CResult_AcceptChannelDecodeErrorZ {
6134 contents: CResult_AcceptChannelDecodeErrorZPtr {
6135 result: Box::into_raw(Box::new(o)),
6141 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
6142 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
6143 CResult_AcceptChannelDecodeErrorZ {
6144 contents: CResult_AcceptChannelDecodeErrorZPtr {
6145 err: Box::into_raw(Box::new(e)),
6151 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
6152 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
6153 impl Drop for CResult_AcceptChannelDecodeErrorZ {
6154 fn drop(&mut self) {
6156 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6157 let _ = unsafe { Box::from_raw(self.contents.result) };
6160 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6161 let _ = unsafe { Box::from_raw(self.contents.err) };
6166 impl From<crate::c_types::CResultTempl<crate::ln::msgs::AcceptChannel, crate::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
6167 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::AcceptChannel, crate::ln::msgs::DecodeError>) -> Self {
6168 let contents = if o.result_ok {
6169 let result = unsafe { o.contents.result };
6170 unsafe { o.contents.result = std::ptr::null_mut() };
6171 CResult_AcceptChannelDecodeErrorZPtr { result }
6173 let err = unsafe { o.contents.err };
6174 unsafe { o.contents.err = std::ptr::null_mut(); }
6175 CResult_AcceptChannelDecodeErrorZPtr { err }
6179 result_ok: o.result_ok,
6183 impl Clone for CResult_AcceptChannelDecodeErrorZ {
6184 fn clone(&self) -> Self {
6186 Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
6187 result: Box::into_raw(Box::new(<crate::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
6190 Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
6191 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6197 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
6198 /// but with all dynamically-allocated buffers duplicated in new buffers.
6199 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { orig.clone() }
6201 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
6202 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
6203 /// A pointer to the contents in the success state.
6204 /// Reading from this pointer when `result_ok` is not set is undefined.
6205 pub result: *mut crate::ln::msgs::AnnouncementSignatures,
6206 /// A pointer to the contents in the error state.
6207 /// Reading from this pointer when `result_ok` is set is undefined.
6208 pub err: *mut crate::ln::msgs::DecodeError,
6211 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
6212 /// containing a crate::ln::msgs::AnnouncementSignatures on success and a crate::ln::msgs::DecodeError on failure.
6213 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6214 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
6215 /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
6216 /// `err` or `result` depending on the state of `result_ok`.
6217 pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
6218 /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
6219 pub result_ok: bool,
6222 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
6223 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
6224 CResult_AnnouncementSignaturesDecodeErrorZ {
6225 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
6226 result: Box::into_raw(Box::new(o)),
6232 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
6233 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
6234 CResult_AnnouncementSignaturesDecodeErrorZ {
6235 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
6236 err: Box::into_raw(Box::new(e)),
6242 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
6243 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
6244 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
6245 fn drop(&mut self) {
6247 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6248 let _ = unsafe { Box::from_raw(self.contents.result) };
6251 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6252 let _ = unsafe { Box::from_raw(self.contents.err) };
6257 impl From<crate::c_types::CResultTempl<crate::ln::msgs::AnnouncementSignatures, crate::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
6258 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::AnnouncementSignatures, crate::ln::msgs::DecodeError>) -> Self {
6259 let contents = if o.result_ok {
6260 let result = unsafe { o.contents.result };
6261 unsafe { o.contents.result = std::ptr::null_mut() };
6262 CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
6264 let err = unsafe { o.contents.err };
6265 unsafe { o.contents.err = std::ptr::null_mut(); }
6266 CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
6270 result_ok: o.result_ok,
6274 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
6275 fn clone(&self) -> Self {
6277 Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
6278 result: Box::into_raw(Box::new(<crate::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
6281 Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
6282 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6288 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
6289 /// but with all dynamically-allocated buffers duplicated in new buffers.
6290 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { orig.clone() }
6292 /// The contents of CResult_ChannelReestablishDecodeErrorZ
6293 pub union CResult_ChannelReestablishDecodeErrorZPtr {
6294 /// A pointer to the contents in the success state.
6295 /// Reading from this pointer when `result_ok` is not set is undefined.
6296 pub result: *mut crate::ln::msgs::ChannelReestablish,
6297 /// A pointer to the contents in the error state.
6298 /// Reading from this pointer when `result_ok` is set is undefined.
6299 pub err: *mut crate::ln::msgs::DecodeError,
6302 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
6303 /// containing a crate::ln::msgs::ChannelReestablish on success and a crate::ln::msgs::DecodeError on failure.
6304 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6305 pub struct CResult_ChannelReestablishDecodeErrorZ {
6306 /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
6307 /// `err` or `result` depending on the state of `result_ok`.
6308 pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
6309 /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
6310 pub result_ok: bool,
6313 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
6314 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
6315 CResult_ChannelReestablishDecodeErrorZ {
6316 contents: CResult_ChannelReestablishDecodeErrorZPtr {
6317 result: Box::into_raw(Box::new(o)),
6323 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
6324 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
6325 CResult_ChannelReestablishDecodeErrorZ {
6326 contents: CResult_ChannelReestablishDecodeErrorZPtr {
6327 err: Box::into_raw(Box::new(e)),
6333 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
6334 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
6335 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
6336 fn drop(&mut self) {
6338 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6339 let _ = unsafe { Box::from_raw(self.contents.result) };
6342 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6343 let _ = unsafe { Box::from_raw(self.contents.err) };
6348 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ChannelReestablish, crate::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
6349 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ChannelReestablish, crate::ln::msgs::DecodeError>) -> Self {
6350 let contents = if o.result_ok {
6351 let result = unsafe { o.contents.result };
6352 unsafe { o.contents.result = std::ptr::null_mut() };
6353 CResult_ChannelReestablishDecodeErrorZPtr { result }
6355 let err = unsafe { o.contents.err };
6356 unsafe { o.contents.err = std::ptr::null_mut(); }
6357 CResult_ChannelReestablishDecodeErrorZPtr { err }
6361 result_ok: o.result_ok,
6365 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
6366 fn clone(&self) -> Self {
6368 Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
6369 result: Box::into_raw(Box::new(<crate::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
6372 Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
6373 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6379 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
6380 /// but with all dynamically-allocated buffers duplicated in new buffers.
6381 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { orig.clone() }
6383 /// The contents of CResult_ClosingSignedDecodeErrorZ
6384 pub union CResult_ClosingSignedDecodeErrorZPtr {
6385 /// A pointer to the contents in the success state.
6386 /// Reading from this pointer when `result_ok` is not set is undefined.
6387 pub result: *mut crate::ln::msgs::ClosingSigned,
6388 /// A pointer to the contents in the error state.
6389 /// Reading from this pointer when `result_ok` is set is undefined.
6390 pub err: *mut crate::ln::msgs::DecodeError,
6393 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
6394 /// containing a crate::ln::msgs::ClosingSigned on success and a crate::ln::msgs::DecodeError on failure.
6395 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6396 pub struct CResult_ClosingSignedDecodeErrorZ {
6397 /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
6398 /// `err` or `result` depending on the state of `result_ok`.
6399 pub contents: CResult_ClosingSignedDecodeErrorZPtr,
6400 /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
6401 pub result_ok: bool,
6404 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
6405 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
6406 CResult_ClosingSignedDecodeErrorZ {
6407 contents: CResult_ClosingSignedDecodeErrorZPtr {
6408 result: Box::into_raw(Box::new(o)),
6414 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
6415 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
6416 CResult_ClosingSignedDecodeErrorZ {
6417 contents: CResult_ClosingSignedDecodeErrorZPtr {
6418 err: Box::into_raw(Box::new(e)),
6424 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
6425 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
6426 impl Drop for CResult_ClosingSignedDecodeErrorZ {
6427 fn drop(&mut self) {
6429 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6430 let _ = unsafe { Box::from_raw(self.contents.result) };
6433 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6434 let _ = unsafe { Box::from_raw(self.contents.err) };
6439 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ClosingSigned, crate::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
6440 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ClosingSigned, crate::ln::msgs::DecodeError>) -> Self {
6441 let contents = if o.result_ok {
6442 let result = unsafe { o.contents.result };
6443 unsafe { o.contents.result = std::ptr::null_mut() };
6444 CResult_ClosingSignedDecodeErrorZPtr { result }
6446 let err = unsafe { o.contents.err };
6447 unsafe { o.contents.err = std::ptr::null_mut(); }
6448 CResult_ClosingSignedDecodeErrorZPtr { err }
6452 result_ok: o.result_ok,
6456 impl Clone for CResult_ClosingSignedDecodeErrorZ {
6457 fn clone(&self) -> Self {
6459 Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
6460 result: Box::into_raw(Box::new(<crate::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
6463 Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
6464 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6470 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
6471 /// but with all dynamically-allocated buffers duplicated in new buffers.
6472 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { orig.clone() }
6474 /// The contents of CResult_CommitmentSignedDecodeErrorZ
6475 pub union CResult_CommitmentSignedDecodeErrorZPtr {
6476 /// A pointer to the contents in the success state.
6477 /// Reading from this pointer when `result_ok` is not set is undefined.
6478 pub result: *mut crate::ln::msgs::CommitmentSigned,
6479 /// A pointer to the contents in the error state.
6480 /// Reading from this pointer when `result_ok` is set is undefined.
6481 pub err: *mut crate::ln::msgs::DecodeError,
6484 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
6485 /// containing a crate::ln::msgs::CommitmentSigned on success and a crate::ln::msgs::DecodeError on failure.
6486 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6487 pub struct CResult_CommitmentSignedDecodeErrorZ {
6488 /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
6489 /// `err` or `result` depending on the state of `result_ok`.
6490 pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
6491 /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
6492 pub result_ok: bool,
6495 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
6496 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
6497 CResult_CommitmentSignedDecodeErrorZ {
6498 contents: CResult_CommitmentSignedDecodeErrorZPtr {
6499 result: Box::into_raw(Box::new(o)),
6505 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
6506 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
6507 CResult_CommitmentSignedDecodeErrorZ {
6508 contents: CResult_CommitmentSignedDecodeErrorZPtr {
6509 err: Box::into_raw(Box::new(e)),
6515 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
6516 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
6517 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
6518 fn drop(&mut self) {
6520 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6521 let _ = unsafe { Box::from_raw(self.contents.result) };
6524 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6525 let _ = unsafe { Box::from_raw(self.contents.err) };
6530 impl From<crate::c_types::CResultTempl<crate::ln::msgs::CommitmentSigned, crate::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
6531 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::CommitmentSigned, crate::ln::msgs::DecodeError>) -> Self {
6532 let contents = if o.result_ok {
6533 let result = unsafe { o.contents.result };
6534 unsafe { o.contents.result = std::ptr::null_mut() };
6535 CResult_CommitmentSignedDecodeErrorZPtr { result }
6537 let err = unsafe { o.contents.err };
6538 unsafe { o.contents.err = std::ptr::null_mut(); }
6539 CResult_CommitmentSignedDecodeErrorZPtr { err }
6543 result_ok: o.result_ok,
6547 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
6548 fn clone(&self) -> Self {
6550 Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
6551 result: Box::into_raw(Box::new(<crate::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
6554 Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
6555 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6561 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
6562 /// but with all dynamically-allocated buffers duplicated in new buffers.
6563 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { orig.clone() }
6565 /// The contents of CResult_FundingCreatedDecodeErrorZ
6566 pub union CResult_FundingCreatedDecodeErrorZPtr {
6567 /// A pointer to the contents in the success state.
6568 /// Reading from this pointer when `result_ok` is not set is undefined.
6569 pub result: *mut crate::ln::msgs::FundingCreated,
6570 /// A pointer to the contents in the error state.
6571 /// Reading from this pointer when `result_ok` is set is undefined.
6572 pub err: *mut crate::ln::msgs::DecodeError,
6575 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
6576 /// containing a crate::ln::msgs::FundingCreated on success and a crate::ln::msgs::DecodeError on failure.
6577 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6578 pub struct CResult_FundingCreatedDecodeErrorZ {
6579 /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
6580 /// `err` or `result` depending on the state of `result_ok`.
6581 pub contents: CResult_FundingCreatedDecodeErrorZPtr,
6582 /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
6583 pub result_ok: bool,
6586 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
6587 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
6588 CResult_FundingCreatedDecodeErrorZ {
6589 contents: CResult_FundingCreatedDecodeErrorZPtr {
6590 result: Box::into_raw(Box::new(o)),
6596 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
6597 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
6598 CResult_FundingCreatedDecodeErrorZ {
6599 contents: CResult_FundingCreatedDecodeErrorZPtr {
6600 err: Box::into_raw(Box::new(e)),
6606 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
6607 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
6608 impl Drop for CResult_FundingCreatedDecodeErrorZ {
6609 fn drop(&mut self) {
6611 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6612 let _ = unsafe { Box::from_raw(self.contents.result) };
6615 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6616 let _ = unsafe { Box::from_raw(self.contents.err) };
6621 impl From<crate::c_types::CResultTempl<crate::ln::msgs::FundingCreated, crate::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
6622 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::FundingCreated, crate::ln::msgs::DecodeError>) -> Self {
6623 let contents = if o.result_ok {
6624 let result = unsafe { o.contents.result };
6625 unsafe { o.contents.result = std::ptr::null_mut() };
6626 CResult_FundingCreatedDecodeErrorZPtr { result }
6628 let err = unsafe { o.contents.err };
6629 unsafe { o.contents.err = std::ptr::null_mut(); }
6630 CResult_FundingCreatedDecodeErrorZPtr { err }
6634 result_ok: o.result_ok,
6638 impl Clone for CResult_FundingCreatedDecodeErrorZ {
6639 fn clone(&self) -> Self {
6641 Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
6642 result: Box::into_raw(Box::new(<crate::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
6645 Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
6646 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6652 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
6653 /// but with all dynamically-allocated buffers duplicated in new buffers.
6654 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { orig.clone() }
6656 /// The contents of CResult_FundingSignedDecodeErrorZ
6657 pub union CResult_FundingSignedDecodeErrorZPtr {
6658 /// A pointer to the contents in the success state.
6659 /// Reading from this pointer when `result_ok` is not set is undefined.
6660 pub result: *mut crate::ln::msgs::FundingSigned,
6661 /// A pointer to the contents in the error state.
6662 /// Reading from this pointer when `result_ok` is set is undefined.
6663 pub err: *mut crate::ln::msgs::DecodeError,
6666 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
6667 /// containing a crate::ln::msgs::FundingSigned on success and a crate::ln::msgs::DecodeError on failure.
6668 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6669 pub struct CResult_FundingSignedDecodeErrorZ {
6670 /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
6671 /// `err` or `result` depending on the state of `result_ok`.
6672 pub contents: CResult_FundingSignedDecodeErrorZPtr,
6673 /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
6674 pub result_ok: bool,
6677 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
6678 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
6679 CResult_FundingSignedDecodeErrorZ {
6680 contents: CResult_FundingSignedDecodeErrorZPtr {
6681 result: Box::into_raw(Box::new(o)),
6687 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
6688 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
6689 CResult_FundingSignedDecodeErrorZ {
6690 contents: CResult_FundingSignedDecodeErrorZPtr {
6691 err: Box::into_raw(Box::new(e)),
6697 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
6698 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
6699 impl Drop for CResult_FundingSignedDecodeErrorZ {
6700 fn drop(&mut self) {
6702 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6703 let _ = unsafe { Box::from_raw(self.contents.result) };
6706 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6707 let _ = unsafe { Box::from_raw(self.contents.err) };
6712 impl From<crate::c_types::CResultTempl<crate::ln::msgs::FundingSigned, crate::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
6713 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::FundingSigned, crate::ln::msgs::DecodeError>) -> Self {
6714 let contents = if o.result_ok {
6715 let result = unsafe { o.contents.result };
6716 unsafe { o.contents.result = std::ptr::null_mut() };
6717 CResult_FundingSignedDecodeErrorZPtr { result }
6719 let err = unsafe { o.contents.err };
6720 unsafe { o.contents.err = std::ptr::null_mut(); }
6721 CResult_FundingSignedDecodeErrorZPtr { err }
6725 result_ok: o.result_ok,
6729 impl Clone for CResult_FundingSignedDecodeErrorZ {
6730 fn clone(&self) -> Self {
6732 Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
6733 result: Box::into_raw(Box::new(<crate::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
6736 Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
6737 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6743 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
6744 /// but with all dynamically-allocated buffers duplicated in new buffers.
6745 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { orig.clone() }
6747 /// The contents of CResult_FundingLockedDecodeErrorZ
6748 pub union CResult_FundingLockedDecodeErrorZPtr {
6749 /// A pointer to the contents in the success state.
6750 /// Reading from this pointer when `result_ok` is not set is undefined.
6751 pub result: *mut crate::ln::msgs::FundingLocked,
6752 /// A pointer to the contents in the error state.
6753 /// Reading from this pointer when `result_ok` is set is undefined.
6754 pub err: *mut crate::ln::msgs::DecodeError,
6757 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
6758 /// containing a crate::ln::msgs::FundingLocked on success and a crate::ln::msgs::DecodeError on failure.
6759 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6760 pub struct CResult_FundingLockedDecodeErrorZ {
6761 /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
6762 /// `err` or `result` depending on the state of `result_ok`.
6763 pub contents: CResult_FundingLockedDecodeErrorZPtr,
6764 /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
6765 pub result_ok: bool,
6768 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
6769 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
6770 CResult_FundingLockedDecodeErrorZ {
6771 contents: CResult_FundingLockedDecodeErrorZPtr {
6772 result: Box::into_raw(Box::new(o)),
6778 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
6779 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
6780 CResult_FundingLockedDecodeErrorZ {
6781 contents: CResult_FundingLockedDecodeErrorZPtr {
6782 err: Box::into_raw(Box::new(e)),
6788 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
6789 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
6790 impl Drop for CResult_FundingLockedDecodeErrorZ {
6791 fn drop(&mut self) {
6793 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6794 let _ = unsafe { Box::from_raw(self.contents.result) };
6797 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6798 let _ = unsafe { Box::from_raw(self.contents.err) };
6803 impl From<crate::c_types::CResultTempl<crate::ln::msgs::FundingLocked, crate::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
6804 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::FundingLocked, crate::ln::msgs::DecodeError>) -> Self {
6805 let contents = if o.result_ok {
6806 let result = unsafe { o.contents.result };
6807 unsafe { o.contents.result = std::ptr::null_mut() };
6808 CResult_FundingLockedDecodeErrorZPtr { result }
6810 let err = unsafe { o.contents.err };
6811 unsafe { o.contents.err = std::ptr::null_mut(); }
6812 CResult_FundingLockedDecodeErrorZPtr { err }
6816 result_ok: o.result_ok,
6820 impl Clone for CResult_FundingLockedDecodeErrorZ {
6821 fn clone(&self) -> Self {
6823 Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
6824 result: Box::into_raw(Box::new(<crate::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
6827 Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
6828 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6834 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
6835 /// but with all dynamically-allocated buffers duplicated in new buffers.
6836 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { orig.clone() }
6838 /// The contents of CResult_InitDecodeErrorZ
6839 pub union CResult_InitDecodeErrorZPtr {
6840 /// A pointer to the contents in the success state.
6841 /// Reading from this pointer when `result_ok` is not set is undefined.
6842 pub result: *mut crate::ln::msgs::Init,
6843 /// A pointer to the contents in the error state.
6844 /// Reading from this pointer when `result_ok` is set is undefined.
6845 pub err: *mut crate::ln::msgs::DecodeError,
6848 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
6849 /// containing a crate::ln::msgs::Init on success and a crate::ln::msgs::DecodeError on failure.
6850 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6851 pub struct CResult_InitDecodeErrorZ {
6852 /// The contents of this CResult_InitDecodeErrorZ, accessible via either
6853 /// `err` or `result` depending on the state of `result_ok`.
6854 pub contents: CResult_InitDecodeErrorZPtr,
6855 /// Whether this CResult_InitDecodeErrorZ represents a success state.
6856 pub result_ok: bool,
6859 /// Creates a new CResult_InitDecodeErrorZ in the success state.
6860 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
6861 CResult_InitDecodeErrorZ {
6862 contents: CResult_InitDecodeErrorZPtr {
6863 result: Box::into_raw(Box::new(o)),
6869 /// Creates a new CResult_InitDecodeErrorZ in the error state.
6870 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
6871 CResult_InitDecodeErrorZ {
6872 contents: CResult_InitDecodeErrorZPtr {
6873 err: Box::into_raw(Box::new(e)),
6879 /// Frees any resources used by the CResult_InitDecodeErrorZ.
6880 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
6881 impl Drop for CResult_InitDecodeErrorZ {
6882 fn drop(&mut self) {
6884 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6885 let _ = unsafe { Box::from_raw(self.contents.result) };
6888 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6889 let _ = unsafe { Box::from_raw(self.contents.err) };
6894 impl From<crate::c_types::CResultTempl<crate::ln::msgs::Init, crate::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
6895 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::Init, crate::ln::msgs::DecodeError>) -> Self {
6896 let contents = if o.result_ok {
6897 let result = unsafe { o.contents.result };
6898 unsafe { o.contents.result = std::ptr::null_mut() };
6899 CResult_InitDecodeErrorZPtr { result }
6901 let err = unsafe { o.contents.err };
6902 unsafe { o.contents.err = std::ptr::null_mut(); }
6903 CResult_InitDecodeErrorZPtr { err }
6907 result_ok: o.result_ok,
6911 impl Clone for CResult_InitDecodeErrorZ {
6912 fn clone(&self) -> Self {
6914 Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
6915 result: Box::into_raw(Box::new(<crate::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
6918 Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
6919 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6925 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
6926 /// but with all dynamically-allocated buffers duplicated in new buffers.
6927 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { orig.clone() }
6929 /// The contents of CResult_OpenChannelDecodeErrorZ
6930 pub union CResult_OpenChannelDecodeErrorZPtr {
6931 /// A pointer to the contents in the success state.
6932 /// Reading from this pointer when `result_ok` is not set is undefined.
6933 pub result: *mut crate::ln::msgs::OpenChannel,
6934 /// A pointer to the contents in the error state.
6935 /// Reading from this pointer when `result_ok` is set is undefined.
6936 pub err: *mut crate::ln::msgs::DecodeError,
6939 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
6940 /// containing a crate::ln::msgs::OpenChannel on success and a crate::ln::msgs::DecodeError on failure.
6941 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6942 pub struct CResult_OpenChannelDecodeErrorZ {
6943 /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
6944 /// `err` or `result` depending on the state of `result_ok`.
6945 pub contents: CResult_OpenChannelDecodeErrorZPtr,
6946 /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
6947 pub result_ok: bool,
6950 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
6951 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
6952 CResult_OpenChannelDecodeErrorZ {
6953 contents: CResult_OpenChannelDecodeErrorZPtr {
6954 result: Box::into_raw(Box::new(o)),
6960 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
6961 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
6962 CResult_OpenChannelDecodeErrorZ {
6963 contents: CResult_OpenChannelDecodeErrorZPtr {
6964 err: Box::into_raw(Box::new(e)),
6970 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
6971 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
6972 impl Drop for CResult_OpenChannelDecodeErrorZ {
6973 fn drop(&mut self) {
6975 if unsafe { !(self.contents.result as *mut ()).is_null() } {
6976 let _ = unsafe { Box::from_raw(self.contents.result) };
6979 if unsafe { !(self.contents.err as *mut ()).is_null() } {
6980 let _ = unsafe { Box::from_raw(self.contents.err) };
6985 impl From<crate::c_types::CResultTempl<crate::ln::msgs::OpenChannel, crate::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
6986 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::OpenChannel, crate::ln::msgs::DecodeError>) -> Self {
6987 let contents = if o.result_ok {
6988 let result = unsafe { o.contents.result };
6989 unsafe { o.contents.result = std::ptr::null_mut() };
6990 CResult_OpenChannelDecodeErrorZPtr { result }
6992 let err = unsafe { o.contents.err };
6993 unsafe { o.contents.err = std::ptr::null_mut(); }
6994 CResult_OpenChannelDecodeErrorZPtr { err }
6998 result_ok: o.result_ok,
7002 impl Clone for CResult_OpenChannelDecodeErrorZ {
7003 fn clone(&self) -> Self {
7005 Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
7006 result: Box::into_raw(Box::new(<crate::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
7009 Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
7010 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7016 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
7017 /// but with all dynamically-allocated buffers duplicated in new buffers.
7018 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { orig.clone() }
7020 /// The contents of CResult_RevokeAndACKDecodeErrorZ
7021 pub union CResult_RevokeAndACKDecodeErrorZPtr {
7022 /// A pointer to the contents in the success state.
7023 /// Reading from this pointer when `result_ok` is not set is undefined.
7024 pub result: *mut crate::ln::msgs::RevokeAndACK,
7025 /// A pointer to the contents in the error state.
7026 /// Reading from this pointer when `result_ok` is set is undefined.
7027 pub err: *mut crate::ln::msgs::DecodeError,
7030 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
7031 /// containing a crate::ln::msgs::RevokeAndACK on success and a crate::ln::msgs::DecodeError on failure.
7032 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7033 pub struct CResult_RevokeAndACKDecodeErrorZ {
7034 /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
7035 /// `err` or `result` depending on the state of `result_ok`.
7036 pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
7037 /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
7038 pub result_ok: bool,
7041 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
7042 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
7043 CResult_RevokeAndACKDecodeErrorZ {
7044 contents: CResult_RevokeAndACKDecodeErrorZPtr {
7045 result: Box::into_raw(Box::new(o)),
7051 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
7052 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
7053 CResult_RevokeAndACKDecodeErrorZ {
7054 contents: CResult_RevokeAndACKDecodeErrorZPtr {
7055 err: Box::into_raw(Box::new(e)),
7061 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
7062 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
7063 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
7064 fn drop(&mut self) {
7066 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7067 let _ = unsafe { Box::from_raw(self.contents.result) };
7070 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7071 let _ = unsafe { Box::from_raw(self.contents.err) };
7076 impl From<crate::c_types::CResultTempl<crate::ln::msgs::RevokeAndACK, crate::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
7077 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::RevokeAndACK, crate::ln::msgs::DecodeError>) -> Self {
7078 let contents = if o.result_ok {
7079 let result = unsafe { o.contents.result };
7080 unsafe { o.contents.result = std::ptr::null_mut() };
7081 CResult_RevokeAndACKDecodeErrorZPtr { result }
7083 let err = unsafe { o.contents.err };
7084 unsafe { o.contents.err = std::ptr::null_mut(); }
7085 CResult_RevokeAndACKDecodeErrorZPtr { err }
7089 result_ok: o.result_ok,
7093 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
7094 fn clone(&self) -> Self {
7096 Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
7097 result: Box::into_raw(Box::new(<crate::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
7100 Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
7101 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7107 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
7108 /// but with all dynamically-allocated buffers duplicated in new buffers.
7109 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { orig.clone() }
7111 /// The contents of CResult_ShutdownDecodeErrorZ
7112 pub union CResult_ShutdownDecodeErrorZPtr {
7113 /// A pointer to the contents in the success state.
7114 /// Reading from this pointer when `result_ok` is not set is undefined.
7115 pub result: *mut crate::ln::msgs::Shutdown,
7116 /// A pointer to the contents in the error state.
7117 /// Reading from this pointer when `result_ok` is set is undefined.
7118 pub err: *mut crate::ln::msgs::DecodeError,
7121 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
7122 /// containing a crate::ln::msgs::Shutdown on success and a crate::ln::msgs::DecodeError on failure.
7123 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7124 pub struct CResult_ShutdownDecodeErrorZ {
7125 /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
7126 /// `err` or `result` depending on the state of `result_ok`.
7127 pub contents: CResult_ShutdownDecodeErrorZPtr,
7128 /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
7129 pub result_ok: bool,
7132 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
7133 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
7134 CResult_ShutdownDecodeErrorZ {
7135 contents: CResult_ShutdownDecodeErrorZPtr {
7136 result: Box::into_raw(Box::new(o)),
7142 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
7143 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
7144 CResult_ShutdownDecodeErrorZ {
7145 contents: CResult_ShutdownDecodeErrorZPtr {
7146 err: Box::into_raw(Box::new(e)),
7152 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
7153 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
7154 impl Drop for CResult_ShutdownDecodeErrorZ {
7155 fn drop(&mut self) {
7157 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7158 let _ = unsafe { Box::from_raw(self.contents.result) };
7161 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7162 let _ = unsafe { Box::from_raw(self.contents.err) };
7167 impl From<crate::c_types::CResultTempl<crate::ln::msgs::Shutdown, crate::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
7168 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::Shutdown, crate::ln::msgs::DecodeError>) -> Self {
7169 let contents = if o.result_ok {
7170 let result = unsafe { o.contents.result };
7171 unsafe { o.contents.result = std::ptr::null_mut() };
7172 CResult_ShutdownDecodeErrorZPtr { result }
7174 let err = unsafe { o.contents.err };
7175 unsafe { o.contents.err = std::ptr::null_mut(); }
7176 CResult_ShutdownDecodeErrorZPtr { err }
7180 result_ok: o.result_ok,
7184 impl Clone for CResult_ShutdownDecodeErrorZ {
7185 fn clone(&self) -> Self {
7187 Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
7188 result: Box::into_raw(Box::new(<crate::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
7191 Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
7192 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7198 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
7199 /// but with all dynamically-allocated buffers duplicated in new buffers.
7200 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { orig.clone() }
7202 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
7203 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
7204 /// A pointer to the contents in the success state.
7205 /// Reading from this pointer when `result_ok` is not set is undefined.
7206 pub result: *mut crate::ln::msgs::UpdateFailHTLC,
7207 /// A pointer to the contents in the error state.
7208 /// Reading from this pointer when `result_ok` is set is undefined.
7209 pub err: *mut crate::ln::msgs::DecodeError,
7212 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
7213 /// containing a crate::ln::msgs::UpdateFailHTLC on success and a crate::ln::msgs::DecodeError on failure.
7214 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7215 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
7216 /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
7217 /// `err` or `result` depending on the state of `result_ok`.
7218 pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
7219 /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
7220 pub result_ok: bool,
7223 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
7224 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
7225 CResult_UpdateFailHTLCDecodeErrorZ {
7226 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
7227 result: Box::into_raw(Box::new(o)),
7233 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
7234 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
7235 CResult_UpdateFailHTLCDecodeErrorZ {
7236 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
7237 err: Box::into_raw(Box::new(e)),
7243 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
7244 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
7245 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
7246 fn drop(&mut self) {
7248 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7249 let _ = unsafe { Box::from_raw(self.contents.result) };
7252 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7253 let _ = unsafe { Box::from_raw(self.contents.err) };
7258 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UpdateFailHTLC, crate::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
7259 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UpdateFailHTLC, crate::ln::msgs::DecodeError>) -> Self {
7260 let contents = if o.result_ok {
7261 let result = unsafe { o.contents.result };
7262 unsafe { o.contents.result = std::ptr::null_mut() };
7263 CResult_UpdateFailHTLCDecodeErrorZPtr { result }
7265 let err = unsafe { o.contents.err };
7266 unsafe { o.contents.err = std::ptr::null_mut(); }
7267 CResult_UpdateFailHTLCDecodeErrorZPtr { err }
7271 result_ok: o.result_ok,
7275 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
7276 fn clone(&self) -> Self {
7278 Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
7279 result: Box::into_raw(Box::new(<crate::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
7282 Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
7283 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7289 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
7290 /// but with all dynamically-allocated buffers duplicated in new buffers.
7291 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { orig.clone() }
7293 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
7294 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
7295 /// A pointer to the contents in the success state.
7296 /// Reading from this pointer when `result_ok` is not set is undefined.
7297 pub result: *mut crate::ln::msgs::UpdateFailMalformedHTLC,
7298 /// A pointer to the contents in the error state.
7299 /// Reading from this pointer when `result_ok` is set is undefined.
7300 pub err: *mut crate::ln::msgs::DecodeError,
7303 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
7304 /// containing a crate::ln::msgs::UpdateFailMalformedHTLC on success and a crate::ln::msgs::DecodeError on failure.
7305 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7306 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7307 /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
7308 /// `err` or `result` depending on the state of `result_ok`.
7309 pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
7310 /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
7311 pub result_ok: bool,
7314 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
7315 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7316 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7317 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
7318 result: Box::into_raw(Box::new(o)),
7324 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
7325 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7326 CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7327 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
7328 err: Box::into_raw(Box::new(e)),
7334 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
7335 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
7336 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7337 fn drop(&mut self) {
7339 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7340 let _ = unsafe { Box::from_raw(self.contents.result) };
7343 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7344 let _ = unsafe { Box::from_raw(self.contents.err) };
7349 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UpdateFailMalformedHTLC, crate::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7350 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UpdateFailMalformedHTLC, crate::ln::msgs::DecodeError>) -> Self {
7351 let contents = if o.result_ok {
7352 let result = unsafe { o.contents.result };
7353 unsafe { o.contents.result = std::ptr::null_mut() };
7354 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
7356 let err = unsafe { o.contents.err };
7357 unsafe { o.contents.err = std::ptr::null_mut(); }
7358 CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
7362 result_ok: o.result_ok,
7366 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
7367 fn clone(&self) -> Self {
7369 Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
7370 result: Box::into_raw(Box::new(<crate::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
7373 Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
7374 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7380 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
7381 /// but with all dynamically-allocated buffers duplicated in new buffers.
7382 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { orig.clone() }
7384 /// The contents of CResult_UpdateFeeDecodeErrorZ
7385 pub union CResult_UpdateFeeDecodeErrorZPtr {
7386 /// A pointer to the contents in the success state.
7387 /// Reading from this pointer when `result_ok` is not set is undefined.
7388 pub result: *mut crate::ln::msgs::UpdateFee,
7389 /// A pointer to the contents in the error state.
7390 /// Reading from this pointer when `result_ok` is set is undefined.
7391 pub err: *mut crate::ln::msgs::DecodeError,
7394 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
7395 /// containing a crate::ln::msgs::UpdateFee on success and a crate::ln::msgs::DecodeError on failure.
7396 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7397 pub struct CResult_UpdateFeeDecodeErrorZ {
7398 /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
7399 /// `err` or `result` depending on the state of `result_ok`.
7400 pub contents: CResult_UpdateFeeDecodeErrorZPtr,
7401 /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
7402 pub result_ok: bool,
7405 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
7406 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
7407 CResult_UpdateFeeDecodeErrorZ {
7408 contents: CResult_UpdateFeeDecodeErrorZPtr {
7409 result: Box::into_raw(Box::new(o)),
7415 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
7416 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
7417 CResult_UpdateFeeDecodeErrorZ {
7418 contents: CResult_UpdateFeeDecodeErrorZPtr {
7419 err: Box::into_raw(Box::new(e)),
7425 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
7426 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
7427 impl Drop for CResult_UpdateFeeDecodeErrorZ {
7428 fn drop(&mut self) {
7430 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7431 let _ = unsafe { Box::from_raw(self.contents.result) };
7434 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7435 let _ = unsafe { Box::from_raw(self.contents.err) };
7440 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UpdateFee, crate::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
7441 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UpdateFee, crate::ln::msgs::DecodeError>) -> Self {
7442 let contents = if o.result_ok {
7443 let result = unsafe { o.contents.result };
7444 unsafe { o.contents.result = std::ptr::null_mut() };
7445 CResult_UpdateFeeDecodeErrorZPtr { result }
7447 let err = unsafe { o.contents.err };
7448 unsafe { o.contents.err = std::ptr::null_mut(); }
7449 CResult_UpdateFeeDecodeErrorZPtr { err }
7453 result_ok: o.result_ok,
7457 impl Clone for CResult_UpdateFeeDecodeErrorZ {
7458 fn clone(&self) -> Self {
7460 Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
7461 result: Box::into_raw(Box::new(<crate::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
7464 Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
7465 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7471 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
7472 /// but with all dynamically-allocated buffers duplicated in new buffers.
7473 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { orig.clone() }
7475 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
7476 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
7477 /// A pointer to the contents in the success state.
7478 /// Reading from this pointer when `result_ok` is not set is undefined.
7479 pub result: *mut crate::ln::msgs::UpdateFulfillHTLC,
7480 /// A pointer to the contents in the error state.
7481 /// Reading from this pointer when `result_ok` is set is undefined.
7482 pub err: *mut crate::ln::msgs::DecodeError,
7485 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
7486 /// containing a crate::ln::msgs::UpdateFulfillHTLC on success and a crate::ln::msgs::DecodeError on failure.
7487 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7488 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
7489 /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
7490 /// `err` or `result` depending on the state of `result_ok`.
7491 pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
7492 /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
7493 pub result_ok: bool,
7496 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
7497 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
7498 CResult_UpdateFulfillHTLCDecodeErrorZ {
7499 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
7500 result: Box::into_raw(Box::new(o)),
7506 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
7507 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
7508 CResult_UpdateFulfillHTLCDecodeErrorZ {
7509 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
7510 err: Box::into_raw(Box::new(e)),
7516 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
7517 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
7518 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
7519 fn drop(&mut self) {
7521 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7522 let _ = unsafe { Box::from_raw(self.contents.result) };
7525 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7526 let _ = unsafe { Box::from_raw(self.contents.err) };
7531 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UpdateFulfillHTLC, crate::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
7532 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UpdateFulfillHTLC, crate::ln::msgs::DecodeError>) -> Self {
7533 let contents = if o.result_ok {
7534 let result = unsafe { o.contents.result };
7535 unsafe { o.contents.result = std::ptr::null_mut() };
7536 CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
7538 let err = unsafe { o.contents.err };
7539 unsafe { o.contents.err = std::ptr::null_mut(); }
7540 CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
7544 result_ok: o.result_ok,
7548 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
7549 fn clone(&self) -> Self {
7551 Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
7552 result: Box::into_raw(Box::new(<crate::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
7555 Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
7556 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7562 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
7563 /// but with all dynamically-allocated buffers duplicated in new buffers.
7564 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { orig.clone() }
7566 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
7567 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
7568 /// A pointer to the contents in the success state.
7569 /// Reading from this pointer when `result_ok` is not set is undefined.
7570 pub result: *mut crate::ln::msgs::UpdateAddHTLC,
7571 /// A pointer to the contents in the error state.
7572 /// Reading from this pointer when `result_ok` is set is undefined.
7573 pub err: *mut crate::ln::msgs::DecodeError,
7576 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
7577 /// containing a crate::ln::msgs::UpdateAddHTLC on success and a crate::ln::msgs::DecodeError on failure.
7578 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7579 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
7580 /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
7581 /// `err` or `result` depending on the state of `result_ok`.
7582 pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
7583 /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
7584 pub result_ok: bool,
7587 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
7588 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
7589 CResult_UpdateAddHTLCDecodeErrorZ {
7590 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
7591 result: Box::into_raw(Box::new(o)),
7597 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
7598 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
7599 CResult_UpdateAddHTLCDecodeErrorZ {
7600 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
7601 err: Box::into_raw(Box::new(e)),
7607 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
7608 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
7609 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
7610 fn drop(&mut self) {
7612 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7613 let _ = unsafe { Box::from_raw(self.contents.result) };
7616 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7617 let _ = unsafe { Box::from_raw(self.contents.err) };
7622 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UpdateAddHTLC, crate::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
7623 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UpdateAddHTLC, crate::ln::msgs::DecodeError>) -> Self {
7624 let contents = if o.result_ok {
7625 let result = unsafe { o.contents.result };
7626 unsafe { o.contents.result = std::ptr::null_mut() };
7627 CResult_UpdateAddHTLCDecodeErrorZPtr { result }
7629 let err = unsafe { o.contents.err };
7630 unsafe { o.contents.err = std::ptr::null_mut(); }
7631 CResult_UpdateAddHTLCDecodeErrorZPtr { err }
7635 result_ok: o.result_ok,
7639 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
7640 fn clone(&self) -> Self {
7642 Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
7643 result: Box::into_raw(Box::new(<crate::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
7646 Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
7647 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7653 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
7654 /// but with all dynamically-allocated buffers duplicated in new buffers.
7655 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { orig.clone() }
7657 /// The contents of CResult_PingDecodeErrorZ
7658 pub union CResult_PingDecodeErrorZPtr {
7659 /// A pointer to the contents in the success state.
7660 /// Reading from this pointer when `result_ok` is not set is undefined.
7661 pub result: *mut crate::ln::msgs::Ping,
7662 /// A pointer to the contents in the error state.
7663 /// Reading from this pointer when `result_ok` is set is undefined.
7664 pub err: *mut crate::ln::msgs::DecodeError,
7667 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
7668 /// containing a crate::ln::msgs::Ping on success and a crate::ln::msgs::DecodeError on failure.
7669 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7670 pub struct CResult_PingDecodeErrorZ {
7671 /// The contents of this CResult_PingDecodeErrorZ, accessible via either
7672 /// `err` or `result` depending on the state of `result_ok`.
7673 pub contents: CResult_PingDecodeErrorZPtr,
7674 /// Whether this CResult_PingDecodeErrorZ represents a success state.
7675 pub result_ok: bool,
7678 /// Creates a new CResult_PingDecodeErrorZ in the success state.
7679 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
7680 CResult_PingDecodeErrorZ {
7681 contents: CResult_PingDecodeErrorZPtr {
7682 result: Box::into_raw(Box::new(o)),
7688 /// Creates a new CResult_PingDecodeErrorZ in the error state.
7689 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
7690 CResult_PingDecodeErrorZ {
7691 contents: CResult_PingDecodeErrorZPtr {
7692 err: Box::into_raw(Box::new(e)),
7698 /// Frees any resources used by the CResult_PingDecodeErrorZ.
7699 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
7700 impl Drop for CResult_PingDecodeErrorZ {
7701 fn drop(&mut self) {
7703 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7704 let _ = unsafe { Box::from_raw(self.contents.result) };
7707 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7708 let _ = unsafe { Box::from_raw(self.contents.err) };
7713 impl From<crate::c_types::CResultTempl<crate::ln::msgs::Ping, crate::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
7714 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::Ping, crate::ln::msgs::DecodeError>) -> Self {
7715 let contents = if o.result_ok {
7716 let result = unsafe { o.contents.result };
7717 unsafe { o.contents.result = std::ptr::null_mut() };
7718 CResult_PingDecodeErrorZPtr { result }
7720 let err = unsafe { o.contents.err };
7721 unsafe { o.contents.err = std::ptr::null_mut(); }
7722 CResult_PingDecodeErrorZPtr { err }
7726 result_ok: o.result_ok,
7730 impl Clone for CResult_PingDecodeErrorZ {
7731 fn clone(&self) -> Self {
7733 Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
7734 result: Box::into_raw(Box::new(<crate::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
7737 Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
7738 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7744 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
7745 /// but with all dynamically-allocated buffers duplicated in new buffers.
7746 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { orig.clone() }
7748 /// The contents of CResult_PongDecodeErrorZ
7749 pub union CResult_PongDecodeErrorZPtr {
7750 /// A pointer to the contents in the success state.
7751 /// Reading from this pointer when `result_ok` is not set is undefined.
7752 pub result: *mut crate::ln::msgs::Pong,
7753 /// A pointer to the contents in the error state.
7754 /// Reading from this pointer when `result_ok` is set is undefined.
7755 pub err: *mut crate::ln::msgs::DecodeError,
7758 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
7759 /// containing a crate::ln::msgs::Pong on success and a crate::ln::msgs::DecodeError on failure.
7760 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7761 pub struct CResult_PongDecodeErrorZ {
7762 /// The contents of this CResult_PongDecodeErrorZ, accessible via either
7763 /// `err` or `result` depending on the state of `result_ok`.
7764 pub contents: CResult_PongDecodeErrorZPtr,
7765 /// Whether this CResult_PongDecodeErrorZ represents a success state.
7766 pub result_ok: bool,
7769 /// Creates a new CResult_PongDecodeErrorZ in the success state.
7770 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
7771 CResult_PongDecodeErrorZ {
7772 contents: CResult_PongDecodeErrorZPtr {
7773 result: Box::into_raw(Box::new(o)),
7779 /// Creates a new CResult_PongDecodeErrorZ in the error state.
7780 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
7781 CResult_PongDecodeErrorZ {
7782 contents: CResult_PongDecodeErrorZPtr {
7783 err: Box::into_raw(Box::new(e)),
7789 /// Frees any resources used by the CResult_PongDecodeErrorZ.
7790 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
7791 impl Drop for CResult_PongDecodeErrorZ {
7792 fn drop(&mut self) {
7794 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7795 let _ = unsafe { Box::from_raw(self.contents.result) };
7798 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7799 let _ = unsafe { Box::from_raw(self.contents.err) };
7804 impl From<crate::c_types::CResultTempl<crate::ln::msgs::Pong, crate::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
7805 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::Pong, crate::ln::msgs::DecodeError>) -> Self {
7806 let contents = if o.result_ok {
7807 let result = unsafe { o.contents.result };
7808 unsafe { o.contents.result = std::ptr::null_mut() };
7809 CResult_PongDecodeErrorZPtr { result }
7811 let err = unsafe { o.contents.err };
7812 unsafe { o.contents.err = std::ptr::null_mut(); }
7813 CResult_PongDecodeErrorZPtr { err }
7817 result_ok: o.result_ok,
7821 impl Clone for CResult_PongDecodeErrorZ {
7822 fn clone(&self) -> Self {
7824 Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
7825 result: Box::into_raw(Box::new(<crate::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
7828 Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
7829 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7835 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
7836 /// but with all dynamically-allocated buffers duplicated in new buffers.
7837 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { orig.clone() }
7839 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
7840 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
7841 /// A pointer to the contents in the success state.
7842 /// Reading from this pointer when `result_ok` is not set is undefined.
7843 pub result: *mut crate::ln::msgs::UnsignedChannelAnnouncement,
7844 /// A pointer to the contents in the error state.
7845 /// Reading from this pointer when `result_ok` is set is undefined.
7846 pub err: *mut crate::ln::msgs::DecodeError,
7849 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
7850 /// containing a crate::ln::msgs::UnsignedChannelAnnouncement on success and a crate::ln::msgs::DecodeError on failure.
7851 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7852 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7853 /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
7854 /// `err` or `result` depending on the state of `result_ok`.
7855 pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
7856 /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
7857 pub result_ok: bool,
7860 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
7861 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7862 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7863 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
7864 result: Box::into_raw(Box::new(o)),
7870 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
7871 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7872 CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7873 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
7874 err: Box::into_raw(Box::new(e)),
7880 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
7881 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
7882 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7883 fn drop(&mut self) {
7885 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7886 let _ = unsafe { Box::from_raw(self.contents.result) };
7889 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7890 let _ = unsafe { Box::from_raw(self.contents.err) };
7895 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UnsignedChannelAnnouncement, crate::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7896 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UnsignedChannelAnnouncement, crate::ln::msgs::DecodeError>) -> Self {
7897 let contents = if o.result_ok {
7898 let result = unsafe { o.contents.result };
7899 unsafe { o.contents.result = std::ptr::null_mut() };
7900 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
7902 let err = unsafe { o.contents.err };
7903 unsafe { o.contents.err = std::ptr::null_mut(); }
7904 CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
7908 result_ok: o.result_ok,
7912 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
7913 fn clone(&self) -> Self {
7915 Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
7916 result: Box::into_raw(Box::new(<crate::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
7919 Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
7920 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7926 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
7927 /// but with all dynamically-allocated buffers duplicated in new buffers.
7928 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { orig.clone() }
7930 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
7931 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
7932 /// A pointer to the contents in the success state.
7933 /// Reading from this pointer when `result_ok` is not set is undefined.
7934 pub result: *mut crate::ln::msgs::ChannelAnnouncement,
7935 /// A pointer to the contents in the error state.
7936 /// Reading from this pointer when `result_ok` is set is undefined.
7937 pub err: *mut crate::ln::msgs::DecodeError,
7940 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
7941 /// containing a crate::ln::msgs::ChannelAnnouncement on success and a crate::ln::msgs::DecodeError on failure.
7942 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7943 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
7944 /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
7945 /// `err` or `result` depending on the state of `result_ok`.
7946 pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
7947 /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
7948 pub result_ok: bool,
7951 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
7952 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
7953 CResult_ChannelAnnouncementDecodeErrorZ {
7954 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
7955 result: Box::into_raw(Box::new(o)),
7961 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
7962 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
7963 CResult_ChannelAnnouncementDecodeErrorZ {
7964 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
7965 err: Box::into_raw(Box::new(e)),
7971 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
7972 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
7973 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
7974 fn drop(&mut self) {
7976 if unsafe { !(self.contents.result as *mut ()).is_null() } {
7977 let _ = unsafe { Box::from_raw(self.contents.result) };
7980 if unsafe { !(self.contents.err as *mut ()).is_null() } {
7981 let _ = unsafe { Box::from_raw(self.contents.err) };
7986 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
7987 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::DecodeError>) -> Self {
7988 let contents = if o.result_ok {
7989 let result = unsafe { o.contents.result };
7990 unsafe { o.contents.result = std::ptr::null_mut() };
7991 CResult_ChannelAnnouncementDecodeErrorZPtr { result }
7993 let err = unsafe { o.contents.err };
7994 unsafe { o.contents.err = std::ptr::null_mut(); }
7995 CResult_ChannelAnnouncementDecodeErrorZPtr { err }
7999 result_ok: o.result_ok,
8003 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
8004 fn clone(&self) -> Self {
8006 Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
8007 result: Box::into_raw(Box::new(<crate::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
8010 Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
8011 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8017 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
8018 /// but with all dynamically-allocated buffers duplicated in new buffers.
8019 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { orig.clone() }
8021 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
8022 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
8023 /// A pointer to the contents in the success state.
8024 /// Reading from this pointer when `result_ok` is not set is undefined.
8025 pub result: *mut crate::ln::msgs::UnsignedChannelUpdate,
8026 /// A pointer to the contents in the error state.
8027 /// Reading from this pointer when `result_ok` is set is undefined.
8028 pub err: *mut crate::ln::msgs::DecodeError,
8031 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
8032 /// containing a crate::ln::msgs::UnsignedChannelUpdate on success and a crate::ln::msgs::DecodeError on failure.
8033 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8034 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
8035 /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
8036 /// `err` or `result` depending on the state of `result_ok`.
8037 pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
8038 /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
8039 pub result_ok: bool,
8042 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
8043 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
8044 CResult_UnsignedChannelUpdateDecodeErrorZ {
8045 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
8046 result: Box::into_raw(Box::new(o)),
8052 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
8053 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
8054 CResult_UnsignedChannelUpdateDecodeErrorZ {
8055 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
8056 err: Box::into_raw(Box::new(e)),
8062 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
8063 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
8064 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
8065 fn drop(&mut self) {
8067 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8068 let _ = unsafe { Box::from_raw(self.contents.result) };
8071 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8072 let _ = unsafe { Box::from_raw(self.contents.err) };
8077 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UnsignedChannelUpdate, crate::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
8078 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UnsignedChannelUpdate, crate::ln::msgs::DecodeError>) -> Self {
8079 let contents = if o.result_ok {
8080 let result = unsafe { o.contents.result };
8081 unsafe { o.contents.result = std::ptr::null_mut() };
8082 CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
8084 let err = unsafe { o.contents.err };
8085 unsafe { o.contents.err = std::ptr::null_mut(); }
8086 CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
8090 result_ok: o.result_ok,
8094 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
8095 fn clone(&self) -> Self {
8097 Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
8098 result: Box::into_raw(Box::new(<crate::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
8101 Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
8102 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8108 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
8109 /// but with all dynamically-allocated buffers duplicated in new buffers.
8110 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { orig.clone() }
8112 /// The contents of CResult_ChannelUpdateDecodeErrorZ
8113 pub union CResult_ChannelUpdateDecodeErrorZPtr {
8114 /// A pointer to the contents in the success state.
8115 /// Reading from this pointer when `result_ok` is not set is undefined.
8116 pub result: *mut crate::ln::msgs::ChannelUpdate,
8117 /// A pointer to the contents in the error state.
8118 /// Reading from this pointer when `result_ok` is set is undefined.
8119 pub err: *mut crate::ln::msgs::DecodeError,
8122 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
8123 /// containing a crate::ln::msgs::ChannelUpdate on success and a crate::ln::msgs::DecodeError on failure.
8124 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8125 pub struct CResult_ChannelUpdateDecodeErrorZ {
8126 /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
8127 /// `err` or `result` depending on the state of `result_ok`.
8128 pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
8129 /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
8130 pub result_ok: bool,
8133 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
8134 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
8135 CResult_ChannelUpdateDecodeErrorZ {
8136 contents: CResult_ChannelUpdateDecodeErrorZPtr {
8137 result: Box::into_raw(Box::new(o)),
8143 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
8144 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
8145 CResult_ChannelUpdateDecodeErrorZ {
8146 contents: CResult_ChannelUpdateDecodeErrorZPtr {
8147 err: Box::into_raw(Box::new(e)),
8153 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
8154 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
8155 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
8156 fn drop(&mut self) {
8158 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8159 let _ = unsafe { Box::from_raw(self.contents.result) };
8162 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8163 let _ = unsafe { Box::from_raw(self.contents.err) };
8168 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ChannelUpdate, crate::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
8169 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ChannelUpdate, crate::ln::msgs::DecodeError>) -> Self {
8170 let contents = if o.result_ok {
8171 let result = unsafe { o.contents.result };
8172 unsafe { o.contents.result = std::ptr::null_mut() };
8173 CResult_ChannelUpdateDecodeErrorZPtr { result }
8175 let err = unsafe { o.contents.err };
8176 unsafe { o.contents.err = std::ptr::null_mut(); }
8177 CResult_ChannelUpdateDecodeErrorZPtr { err }
8181 result_ok: o.result_ok,
8185 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
8186 fn clone(&self) -> Self {
8188 Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
8189 result: Box::into_raw(Box::new(<crate::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
8192 Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
8193 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8199 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
8200 /// but with all dynamically-allocated buffers duplicated in new buffers.
8201 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { orig.clone() }
8203 /// The contents of CResult_ErrorMessageDecodeErrorZ
8204 pub union CResult_ErrorMessageDecodeErrorZPtr {
8205 /// A pointer to the contents in the success state.
8206 /// Reading from this pointer when `result_ok` is not set is undefined.
8207 pub result: *mut crate::ln::msgs::ErrorMessage,
8208 /// A pointer to the contents in the error state.
8209 /// Reading from this pointer when `result_ok` is set is undefined.
8210 pub err: *mut crate::ln::msgs::DecodeError,
8213 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
8214 /// containing a crate::ln::msgs::ErrorMessage on success and a crate::ln::msgs::DecodeError on failure.
8215 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8216 pub struct CResult_ErrorMessageDecodeErrorZ {
8217 /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
8218 /// `err` or `result` depending on the state of `result_ok`.
8219 pub contents: CResult_ErrorMessageDecodeErrorZPtr,
8220 /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
8221 pub result_ok: bool,
8224 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
8225 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
8226 CResult_ErrorMessageDecodeErrorZ {
8227 contents: CResult_ErrorMessageDecodeErrorZPtr {
8228 result: Box::into_raw(Box::new(o)),
8234 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
8235 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
8236 CResult_ErrorMessageDecodeErrorZ {
8237 contents: CResult_ErrorMessageDecodeErrorZPtr {
8238 err: Box::into_raw(Box::new(e)),
8244 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
8245 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
8246 impl Drop for CResult_ErrorMessageDecodeErrorZ {
8247 fn drop(&mut self) {
8249 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8250 let _ = unsafe { Box::from_raw(self.contents.result) };
8253 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8254 let _ = unsafe { Box::from_raw(self.contents.err) };
8259 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ErrorMessage, crate::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
8260 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ErrorMessage, crate::ln::msgs::DecodeError>) -> Self {
8261 let contents = if o.result_ok {
8262 let result = unsafe { o.contents.result };
8263 unsafe { o.contents.result = std::ptr::null_mut() };
8264 CResult_ErrorMessageDecodeErrorZPtr { result }
8266 let err = unsafe { o.contents.err };
8267 unsafe { o.contents.err = std::ptr::null_mut(); }
8268 CResult_ErrorMessageDecodeErrorZPtr { err }
8272 result_ok: o.result_ok,
8276 impl Clone for CResult_ErrorMessageDecodeErrorZ {
8277 fn clone(&self) -> Self {
8279 Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
8280 result: Box::into_raw(Box::new(<crate::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
8283 Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
8284 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8290 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
8291 /// but with all dynamically-allocated buffers duplicated in new buffers.
8292 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { orig.clone() }
8294 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
8295 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
8296 /// A pointer to the contents in the success state.
8297 /// Reading from this pointer when `result_ok` is not set is undefined.
8298 pub result: *mut crate::ln::msgs::UnsignedNodeAnnouncement,
8299 /// A pointer to the contents in the error state.
8300 /// Reading from this pointer when `result_ok` is set is undefined.
8301 pub err: *mut crate::ln::msgs::DecodeError,
8304 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
8305 /// containing a crate::ln::msgs::UnsignedNodeAnnouncement on success and a crate::ln::msgs::DecodeError on failure.
8306 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8307 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8308 /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
8309 /// `err` or `result` depending on the state of `result_ok`.
8310 pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
8311 /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
8312 pub result_ok: bool,
8315 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
8316 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8317 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8318 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
8319 result: Box::into_raw(Box::new(o)),
8325 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
8326 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8327 CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8328 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
8329 err: Box::into_raw(Box::new(e)),
8335 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
8336 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
8337 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8338 fn drop(&mut self) {
8340 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8341 let _ = unsafe { Box::from_raw(self.contents.result) };
8344 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8345 let _ = unsafe { Box::from_raw(self.contents.err) };
8350 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UnsignedNodeAnnouncement, crate::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8351 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UnsignedNodeAnnouncement, crate::ln::msgs::DecodeError>) -> Self {
8352 let contents = if o.result_ok {
8353 let result = unsafe { o.contents.result };
8354 unsafe { o.contents.result = std::ptr::null_mut() };
8355 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
8357 let err = unsafe { o.contents.err };
8358 unsafe { o.contents.err = std::ptr::null_mut(); }
8359 CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
8363 result_ok: o.result_ok,
8367 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
8368 fn clone(&self) -> Self {
8370 Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
8371 result: Box::into_raw(Box::new(<crate::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
8374 Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
8375 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8381 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
8382 /// but with all dynamically-allocated buffers duplicated in new buffers.
8383 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { orig.clone() }
8385 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
8386 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
8387 /// A pointer to the contents in the success state.
8388 /// Reading from this pointer when `result_ok` is not set is undefined.
8389 pub result: *mut crate::ln::msgs::NodeAnnouncement,
8390 /// A pointer to the contents in the error state.
8391 /// Reading from this pointer when `result_ok` is set is undefined.
8392 pub err: *mut crate::ln::msgs::DecodeError,
8395 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
8396 /// containing a crate::ln::msgs::NodeAnnouncement on success and a crate::ln::msgs::DecodeError on failure.
8397 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8398 pub struct CResult_NodeAnnouncementDecodeErrorZ {
8399 /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
8400 /// `err` or `result` depending on the state of `result_ok`.
8401 pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
8402 /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
8403 pub result_ok: bool,
8406 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
8407 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
8408 CResult_NodeAnnouncementDecodeErrorZ {
8409 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
8410 result: Box::into_raw(Box::new(o)),
8416 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
8417 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
8418 CResult_NodeAnnouncementDecodeErrorZ {
8419 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
8420 err: Box::into_raw(Box::new(e)),
8426 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
8427 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
8428 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
8429 fn drop(&mut self) {
8431 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8432 let _ = unsafe { Box::from_raw(self.contents.result) };
8435 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8436 let _ = unsafe { Box::from_raw(self.contents.err) };
8441 impl From<crate::c_types::CResultTempl<crate::ln::msgs::NodeAnnouncement, crate::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
8442 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::NodeAnnouncement, crate::ln::msgs::DecodeError>) -> Self {
8443 let contents = if o.result_ok {
8444 let result = unsafe { o.contents.result };
8445 unsafe { o.contents.result = std::ptr::null_mut() };
8446 CResult_NodeAnnouncementDecodeErrorZPtr { result }
8448 let err = unsafe { o.contents.err };
8449 unsafe { o.contents.err = std::ptr::null_mut(); }
8450 CResult_NodeAnnouncementDecodeErrorZPtr { err }
8454 result_ok: o.result_ok,
8458 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
8459 fn clone(&self) -> Self {
8461 Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
8462 result: Box::into_raw(Box::new(<crate::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
8465 Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
8466 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8472 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
8473 /// but with all dynamically-allocated buffers duplicated in new buffers.
8474 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { orig.clone() }
8476 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
8477 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
8478 /// A pointer to the contents in the success state.
8479 /// Reading from this pointer when `result_ok` is not set is undefined.
8480 pub result: *mut crate::ln::msgs::QueryShortChannelIds,
8481 /// A pointer to the contents in the error state.
8482 /// Reading from this pointer when `result_ok` is set is undefined.
8483 pub err: *mut crate::ln::msgs::DecodeError,
8486 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
8487 /// containing a crate::ln::msgs::QueryShortChannelIds on success and a crate::ln::msgs::DecodeError on failure.
8488 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8489 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
8490 /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
8491 /// `err` or `result` depending on the state of `result_ok`.
8492 pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
8493 /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
8494 pub result_ok: bool,
8497 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
8498 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
8499 CResult_QueryShortChannelIdsDecodeErrorZ {
8500 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
8501 result: Box::into_raw(Box::new(o)),
8507 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
8508 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
8509 CResult_QueryShortChannelIdsDecodeErrorZ {
8510 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
8511 err: Box::into_raw(Box::new(e)),
8517 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
8518 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
8519 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
8520 fn drop(&mut self) {
8522 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8523 let _ = unsafe { Box::from_raw(self.contents.result) };
8526 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8527 let _ = unsafe { Box::from_raw(self.contents.err) };
8532 impl From<crate::c_types::CResultTempl<crate::ln::msgs::QueryShortChannelIds, crate::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
8533 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::QueryShortChannelIds, crate::ln::msgs::DecodeError>) -> Self {
8534 let contents = if o.result_ok {
8535 let result = unsafe { o.contents.result };
8536 unsafe { o.contents.result = std::ptr::null_mut() };
8537 CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
8539 let err = unsafe { o.contents.err };
8540 unsafe { o.contents.err = std::ptr::null_mut(); }
8541 CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
8545 result_ok: o.result_ok,
8549 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
8550 fn clone(&self) -> Self {
8552 Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
8553 result: Box::into_raw(Box::new(<crate::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
8556 Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
8557 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8563 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
8564 /// but with all dynamically-allocated buffers duplicated in new buffers.
8565 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { orig.clone() }
8567 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
8568 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
8569 /// A pointer to the contents in the success state.
8570 /// Reading from this pointer when `result_ok` is not set is undefined.
8571 pub result: *mut crate::ln::msgs::ReplyShortChannelIdsEnd,
8572 /// A pointer to the contents in the error state.
8573 /// Reading from this pointer when `result_ok` is set is undefined.
8574 pub err: *mut crate::ln::msgs::DecodeError,
8577 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
8578 /// containing a crate::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::ln::msgs::DecodeError on failure.
8579 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8580 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8581 /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
8582 /// `err` or `result` depending on the state of `result_ok`.
8583 pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
8584 /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
8585 pub result_ok: bool,
8588 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
8589 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8590 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8591 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
8592 result: Box::into_raw(Box::new(o)),
8598 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
8599 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8600 CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8601 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
8602 err: Box::into_raw(Box::new(e)),
8608 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
8609 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
8610 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8611 fn drop(&mut self) {
8613 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8614 let _ = unsafe { Box::from_raw(self.contents.result) };
8617 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8618 let _ = unsafe { Box::from_raw(self.contents.err) };
8623 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ReplyShortChannelIdsEnd, crate::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8624 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ReplyShortChannelIdsEnd, crate::ln::msgs::DecodeError>) -> Self {
8625 let contents = if o.result_ok {
8626 let result = unsafe { o.contents.result };
8627 unsafe { o.contents.result = std::ptr::null_mut() };
8628 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
8630 let err = unsafe { o.contents.err };
8631 unsafe { o.contents.err = std::ptr::null_mut(); }
8632 CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
8636 result_ok: o.result_ok,
8640 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
8641 fn clone(&self) -> Self {
8643 Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
8644 result: Box::into_raw(Box::new(<crate::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
8647 Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
8648 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8654 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
8655 /// but with all dynamically-allocated buffers duplicated in new buffers.
8656 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { orig.clone() }
8658 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
8659 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
8660 /// A pointer to the contents in the success state.
8661 /// Reading from this pointer when `result_ok` is not set is undefined.
8662 pub result: *mut crate::ln::msgs::QueryChannelRange,
8663 /// A pointer to the contents in the error state.
8664 /// Reading from this pointer when `result_ok` is set is undefined.
8665 pub err: *mut crate::ln::msgs::DecodeError,
8668 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
8669 /// containing a crate::ln::msgs::QueryChannelRange on success and a crate::ln::msgs::DecodeError on failure.
8670 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8671 pub struct CResult_QueryChannelRangeDecodeErrorZ {
8672 /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
8673 /// `err` or `result` depending on the state of `result_ok`.
8674 pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
8675 /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
8676 pub result_ok: bool,
8679 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
8680 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
8681 CResult_QueryChannelRangeDecodeErrorZ {
8682 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
8683 result: Box::into_raw(Box::new(o)),
8689 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
8690 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
8691 CResult_QueryChannelRangeDecodeErrorZ {
8692 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
8693 err: Box::into_raw(Box::new(e)),
8699 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
8700 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
8701 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
8702 fn drop(&mut self) {
8704 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8705 let _ = unsafe { Box::from_raw(self.contents.result) };
8708 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8709 let _ = unsafe { Box::from_raw(self.contents.err) };
8714 impl From<crate::c_types::CResultTempl<crate::ln::msgs::QueryChannelRange, crate::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
8715 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::QueryChannelRange, crate::ln::msgs::DecodeError>) -> Self {
8716 let contents = if o.result_ok {
8717 let result = unsafe { o.contents.result };
8718 unsafe { o.contents.result = std::ptr::null_mut() };
8719 CResult_QueryChannelRangeDecodeErrorZPtr { result }
8721 let err = unsafe { o.contents.err };
8722 unsafe { o.contents.err = std::ptr::null_mut(); }
8723 CResult_QueryChannelRangeDecodeErrorZPtr { err }
8727 result_ok: o.result_ok,
8731 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
8732 fn clone(&self) -> Self {
8734 Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
8735 result: Box::into_raw(Box::new(<crate::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
8738 Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
8739 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8745 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
8746 /// but with all dynamically-allocated buffers duplicated in new buffers.
8747 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { orig.clone() }
8749 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
8750 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
8751 /// A pointer to the contents in the success state.
8752 /// Reading from this pointer when `result_ok` is not set is undefined.
8753 pub result: *mut crate::ln::msgs::ReplyChannelRange,
8754 /// A pointer to the contents in the error state.
8755 /// Reading from this pointer when `result_ok` is set is undefined.
8756 pub err: *mut crate::ln::msgs::DecodeError,
8759 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
8760 /// containing a crate::ln::msgs::ReplyChannelRange on success and a crate::ln::msgs::DecodeError on failure.
8761 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8762 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
8763 /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
8764 /// `err` or `result` depending on the state of `result_ok`.
8765 pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
8766 /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
8767 pub result_ok: bool,
8770 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
8771 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
8772 CResult_ReplyChannelRangeDecodeErrorZ {
8773 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
8774 result: Box::into_raw(Box::new(o)),
8780 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
8781 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
8782 CResult_ReplyChannelRangeDecodeErrorZ {
8783 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
8784 err: Box::into_raw(Box::new(e)),
8790 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
8791 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
8792 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
8793 fn drop(&mut self) {
8795 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8796 let _ = unsafe { Box::from_raw(self.contents.result) };
8799 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8800 let _ = unsafe { Box::from_raw(self.contents.err) };
8805 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ReplyChannelRange, crate::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
8806 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ReplyChannelRange, crate::ln::msgs::DecodeError>) -> Self {
8807 let contents = if o.result_ok {
8808 let result = unsafe { o.contents.result };
8809 unsafe { o.contents.result = std::ptr::null_mut() };
8810 CResult_ReplyChannelRangeDecodeErrorZPtr { result }
8812 let err = unsafe { o.contents.err };
8813 unsafe { o.contents.err = std::ptr::null_mut(); }
8814 CResult_ReplyChannelRangeDecodeErrorZPtr { err }
8818 result_ok: o.result_ok,
8822 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
8823 fn clone(&self) -> Self {
8825 Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
8826 result: Box::into_raw(Box::new(<crate::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
8829 Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
8830 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8836 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
8837 /// but with all dynamically-allocated buffers duplicated in new buffers.
8838 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { orig.clone() }
8840 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
8841 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
8842 /// A pointer to the contents in the success state.
8843 /// Reading from this pointer when `result_ok` is not set is undefined.
8844 pub result: *mut crate::ln::msgs::GossipTimestampFilter,
8845 /// A pointer to the contents in the error state.
8846 /// Reading from this pointer when `result_ok` is set is undefined.
8847 pub err: *mut crate::ln::msgs::DecodeError,
8850 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
8851 /// containing a crate::ln::msgs::GossipTimestampFilter on success and a crate::ln::msgs::DecodeError on failure.
8852 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8853 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
8854 /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
8855 /// `err` or `result` depending on the state of `result_ok`.
8856 pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
8857 /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
8858 pub result_ok: bool,
8861 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
8862 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
8863 CResult_GossipTimestampFilterDecodeErrorZ {
8864 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
8865 result: Box::into_raw(Box::new(o)),
8871 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
8872 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
8873 CResult_GossipTimestampFilterDecodeErrorZ {
8874 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
8875 err: Box::into_raw(Box::new(e)),
8881 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
8882 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
8883 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
8884 fn drop(&mut self) {
8886 if unsafe { !(self.contents.result as *mut ()).is_null() } {
8887 let _ = unsafe { Box::from_raw(self.contents.result) };
8890 if unsafe { !(self.contents.err as *mut ()).is_null() } {
8891 let _ = unsafe { Box::from_raw(self.contents.err) };
8896 impl From<crate::c_types::CResultTempl<crate::ln::msgs::GossipTimestampFilter, crate::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
8897 fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::GossipTimestampFilter, crate::ln::msgs::DecodeError>) -> Self {
8898 let contents = if o.result_ok {
8899 let result = unsafe { o.contents.result };
8900 unsafe { o.contents.result = std::ptr::null_mut() };
8901 CResult_GossipTimestampFilterDecodeErrorZPtr { result }
8903 let err = unsafe { o.contents.err };
8904 unsafe { o.contents.err = std::ptr::null_mut(); }
8905 CResult_GossipTimestampFilterDecodeErrorZPtr { err }
8909 result_ok: o.result_ok,
8913 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
8914 fn clone(&self) -> Self {
8916 Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
8917 result: Box::into_raw(Box::new(<crate::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
8920 Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
8921 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8927 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
8928 /// but with all dynamically-allocated buffers duplicated in new buffers.
8929 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { orig.clone() }