/// Error types that these functions can return
use alloc::str::FromStr;
+use alloc::string::String;
use core::ffi::c_void;
use core::convert::Infallible;
use bitcoin::hashes::Hash;
pub(crate) fn to_native(&self) -> nativeGraphSyncError {
match self {
GraphSyncError::DecodeError (ref a, ) => {
- let mut a_nonref = (*a).clone();
+ let mut a_nonref = Clone::clone(a);
nativeGraphSyncError::DecodeError (
- *unsafe { Box::from_raw(a_nonref.take_inner()) },
+ a_nonref.into_native(),
)
},
GraphSyncError::LightningError (ref a, ) => {
- let mut a_nonref = (*a).clone();
+ let mut a_nonref = Clone::clone(a);
nativeGraphSyncError::LightningError (
*unsafe { Box::from_raw(a_nonref.take_inner()) },
)
match self {
GraphSyncError::DecodeError (mut a, ) => {
nativeGraphSyncError::DecodeError (
- *unsafe { Box::from_raw(a.take_inner()) },
+ a.into_native(),
)
},
GraphSyncError::LightningError (mut a, ) => {
pub(crate) fn from_native(native: &nativeGraphSyncError) -> Self {
match native {
nativeGraphSyncError::DecodeError (ref a, ) => {
- let mut a_nonref = (*a).clone();
+ let mut a_nonref = Clone::clone(a);
GraphSyncError::DecodeError (
- crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(a_nonref), is_owned: true },
+ crate::lightning::ln::msgs::DecodeError::native_into(a_nonref),
)
},
nativeGraphSyncError::LightningError (ref a, ) => {
- let mut a_nonref = (*a).clone();
+ let mut a_nonref = Clone::clone(a);
GraphSyncError::LightningError (
crate::lightning::ln::msgs::LightningError { inner: ObjOps::heap_alloc(a_nonref), is_owned: true },
)
match native {
nativeGraphSyncError::DecodeError (mut a, ) => {
GraphSyncError::DecodeError (
- crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(a), is_owned: true },
+ crate::lightning::ln::msgs::DecodeError::native_into(a),
)
},
nativeGraphSyncError::LightningError (mut a, ) => {
pub extern "C" fn GraphSyncError_clone(orig: &GraphSyncError) -> GraphSyncError {
orig.clone()
}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn GraphSyncError_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const GraphSyncError)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn GraphSyncError_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut GraphSyncError) };
+}
#[no_mangle]
/// Utility method to constructs a new DecodeError-variant GraphSyncError
pub extern "C" fn GraphSyncError_decode_error(a: crate::lightning::ln::msgs::DecodeError) -> GraphSyncError {