Trait uniffi::Lower

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

    // 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 Methods§

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

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

Provided Methods§

fn lower_into_rust_buffer(obj: Self) -> RustBuffer

Convenience method

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

§

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

§

type FfiType = RustBuffer

§

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

§

fn lower(obj: HashMap<K, V>) -> RustBuffer

§

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

§

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

§

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

§

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

§

impl<UT> Lower<UT> for bool

§

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

§

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

§

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

§

impl<UT> Lower<UT> for f32

§

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

§

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

§

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

§

impl<UT> Lower<UT> for f64

§

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

§

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

§

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

§

impl<UT> Lower<UT> for i8

§

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

§

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

§

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

§

impl<UT> Lower<UT> for i16

§

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

§

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

§

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

§

impl<UT> Lower<UT> for i32

§

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

§

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

§

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

§

impl<UT> Lower<UT> for i64

§

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

§

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

§

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

§

impl<UT> Lower<UT> for u8

§

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

§

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

§

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

§

impl<UT> Lower<UT> for u16

§

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

§

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

§

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

§

impl<UT> Lower<UT> for u32

§

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

§

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

§

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

§

impl<UT> Lower<UT> for u64

§

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

§

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

§

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

§

impl<UT> Lower<UT> for String

§

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

§

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

§

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

§

impl<UT> Lower<UT> for SystemTime

§

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

§

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

§

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

§

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

§

type FfiType = RustBuffer

§

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

§

fn lower(obj: Vec<T>) -> RustBuffer

Implementors§

§

impl<UT> Lower<UT> for Duration

§

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