pub unsafe trait FfiConverterArc<UT>: Send + Sync {
    type FfiType: FfiDefault;

    const TYPE_ID_META: MetadataBuffer;

    // Required methods
    fn lower(obj: Arc<Self>) -> Self::FfiType;
    fn try_lift(v: Self::FfiType) -> Result<Arc<Self>, Error>;
    fn write(obj: Arc<Self>, buf: &mut Vec<u8>);
    fn try_read(buf: &mut &[u8]) -> Result<Arc<Self>, Error>;
}
Expand description

Reexport items from other uniffi creates FfiConverter for Arc-types

This trait gets around the orphan rule limitations, which prevent library crates from implementing FfiConverter on an Arc. When this is implemented for T, we generate an FfiConverter impl for Arc.

Note: There’s no need for FfiConverterBox, since Box is a fundamental type.

§Safety

All traits are unsafe (implementing it requires unsafe impl) because we can’t guarantee that it’s safe to pass your type out to foreign-language code and back again. Buggy implementations of this trait might violate some assumptions made by the generated code, or might not match with the corresponding code in the generated foreign-language bindings. These traits should not be used directly, only in generated code, and the generated code should have fixture tests to test that everything works correctly together.

Required Associated Types§

Required Associated Constants§

Required Methods§

fn lower(obj: Arc<Self>) -> Self::FfiType

fn try_lift(v: Self::FfiType) -> Result<Arc<Self>, Error>

fn write(obj: Arc<Self>, buf: &mut Vec<u8>)

fn try_read(buf: &mut &[u8]) -> Result<Arc<Self>, Error>

Object Safety§

This trait is not object safe.

Implementors§