Trait uniffi::Lower

source ·
pub unsafe trait Lower<UT>: Sized {
    type FfiType: FfiDefault;

    const TYPE_ID_META: MetadataBuffer;

    // Required methods
    fn lower(obj: Self) -> Self::FfiType;
    fn write(obj: Self, buf: &mut Vec<u8>);

    // Provided method
    fn lower_into_rust_buffer(obj: Self) -> RustBuffer { ... }
}
Expand description

Reexport items from other uniffi creates Lower Rust values to pass them to the foreign code

This is used to pass arguments to callback interfaces. It’s usually derived from FfiConverter, except for types that only support lowering but not lifting.

See FfiConverter for a discussion of the methods

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§

source

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

source

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

Provided Methods§

source

fn lower_into_rust_buffer(obj: Self) -> RustBuffer

Convenience method

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<K, V, UT> Lower<UT> for HashMap<K, V>
where K: Lower<UT> + Hash + Eq, V: Lower<UT>,

source§

impl<T, UT> Lower<UT> for Arc<T>
where Arc<T>: FfiConverter<UT>, T: ?Sized,

§

type FfiType = <Arc<T> as FfiConverter<UT>>::FfiType

source§

fn lower(obj: Arc<T>) -> <Arc<T> as Lower<UT>>::FfiType

source§

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

source§

const TYPE_ID_META: MetadataBuffer = _

source§

impl<UT> Lower<UT> for bool

§

type FfiType = <bool as FfiConverter<UT>>::FfiType

source§

fn lower(obj: bool) -> <bool as Lower<UT>>::FfiType

source§

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

source§

const TYPE_ID_META: MetadataBuffer = _

source§

impl<UT> Lower<UT> for f32

§

type FfiType = <f32 as FfiConverter<UT>>::FfiType

source§

fn lower(obj: f32) -> <f32 as Lower<UT>>::FfiType

source§

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

source§

const TYPE_ID_META: MetadataBuffer = _

source§

impl<UT> Lower<UT> for f64

§

type FfiType = <f64 as FfiConverter<UT>>::FfiType

source§

fn lower(obj: f64) -> <f64 as Lower<UT>>::FfiType

source§

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

source§

const TYPE_ID_META: MetadataBuffer = _

source§

impl<UT> Lower<UT> for i8

§

type FfiType = <i8 as FfiConverter<UT>>::FfiType

source§

fn lower(obj: i8) -> <i8 as Lower<UT>>::FfiType

source§

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

source§

const TYPE_ID_META: MetadataBuffer = _

source§

impl<UT> Lower<UT> for i16

§

type FfiType = <i16 as FfiConverter<UT>>::FfiType

source§

fn lower(obj: i16) -> <i16 as Lower<UT>>::FfiType

source§

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

source§

const TYPE_ID_META: MetadataBuffer = _

source§

impl<UT> Lower<UT> for i32

§

type FfiType = <i32 as FfiConverter<UT>>::FfiType

source§

fn lower(obj: i32) -> <i32 as Lower<UT>>::FfiType

source§

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

source§

const TYPE_ID_META: MetadataBuffer = _

source§

impl<UT> Lower<UT> for i64

§

type FfiType = <i64 as FfiConverter<UT>>::FfiType

source§

fn lower(obj: i64) -> <i64 as Lower<UT>>::FfiType

source§

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

source§

const TYPE_ID_META: MetadataBuffer = _

source§

impl<UT> Lower<UT> for u8

§

type FfiType = <u8 as FfiConverter<UT>>::FfiType

source§

fn lower(obj: u8) -> <u8 as Lower<UT>>::FfiType

source§

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

source§

const TYPE_ID_META: MetadataBuffer = _

source§

impl<UT> Lower<UT> for u16

§

type FfiType = <u16 as FfiConverter<UT>>::FfiType

source§

fn lower(obj: u16) -> <u16 as Lower<UT>>::FfiType

source§

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

source§

const TYPE_ID_META: MetadataBuffer = _

source§

impl<UT> Lower<UT> for u32

§

type FfiType = <u32 as FfiConverter<UT>>::FfiType

source§

fn lower(obj: u32) -> <u32 as Lower<UT>>::FfiType

source§

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

source§

const TYPE_ID_META: MetadataBuffer = _

source§

impl<UT> Lower<UT> for u64

§

type FfiType = <u64 as FfiConverter<UT>>::FfiType

source§

fn lower(obj: u64) -> <u64 as Lower<UT>>::FfiType

source§

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

source§

const TYPE_ID_META: MetadataBuffer = _

source§

impl<UT> Lower<UT> for String

source§

impl<UT> Lower<UT> for SystemTime

source§

impl<UT, T> Lower<UT> for Vec<T>
where T: Lower<UT>,

Implementors§