use ::ffi_sdk::{ffi_utils::repr_c, FfiError};
pub use cbor_value::CborValueGetters;
mod cbor_value;
pub(crate) trait RefCounted: Clone {
fn retain(&self) -> Self {
Clone::clone(self)
}
#[rustfmt::skip]
fn clone(&self) -> Self { Clone::clone(self)
}
}
impl<T: ?Sized> RefCounted for ::std::rc::Rc<T> {}
impl<T: ?Sized> RefCounted for ::std::sync::Arc<T> {}
pub(crate) trait FfiResultIntoRustResult {
type Result;
fn into_rust_result(self) -> Self::Result;
}
impl<T: ::safer_ffi::layout::ReprC> FfiResultIntoRustResult for repr_c::FfiResult<T> {
type Result = Result<T, repr_c::Box<FfiError>>;
fn into_rust_result(self) -> Self::Result {
if let Some(error) = self.error {
Err(error)
} else {
Ok(unsafe {
if ::core::mem::size_of::<T>() > 0 {
::safer_ffi::layout::from_raw_unchecked(self.success)
} else {
::core::mem::transmute_copy(&self.success)
}
})
}
}
}