Macro uniffi::derive_ffi_traits
macro_rules! derive_ffi_traits { (blanket $ty:ty) => { ... }; (local $ty:ty) => { ... }; (impl $(<$($generic:ident),*>)? $(::uniffi::)? Lower<$ut:path> for $ty:ty $(where $($where:tt)*)?) => { ... }; (impl $(<$($generic:ident),*>)? $(::uniffi::)? Lift<$ut:path> for $ty:ty $(where $($where:tt)*)?) => { ... }; (impl $(<$($generic:ident),*>)? $(::uniffi::)? LowerReturn<$ut:path> for $ty:ty $(where $($where:tt)*)?) => { ... }; (impl $(<$($generic:ident),*>)? $(::uniffi::)? LiftReturn<$ut:path> for $ty:ty $(where $($where:tt)*)?) => { ... }; (impl $(<$($generic:ident),*>)? $(::uniffi::)? LiftRef<$ut:path> for $ty:ty $(where $($where:tt)*)?) => { ... }; (impl $(<$($generic:ident),*>)? $(::uniffi::)? ConvertError<$ut:path> for $ty:ty $(where $($where:tt)*)?) => { ... }; (impl $(<$($generic:ident),*>)? $(::uniffi::)? HandleAlloc<$ut:path> for $ty:ty $(where $($where:tt)*)?) => { ... }; }
Expand description
Derive FFI traits
This can be used to derive:
- Lower and Lift from FfiConverter
- LowerReturn from Lower
- LiftReturn and LiftRef from Lift
Usage:
ⓘ
// Derive everything from [FfiConverter] for all Uniffi tags
::uniffi::derive_ffi_traits!(blanket Foo)
// Derive everything from [FfiConverter] for the local crate::UniFfiTag
::uniffi::derive_ffi_traits!(local Foo)
// To derive a specific trait, write out the impl item minus the actual block
::uniffi::derive_ffi_traits!(impl<T, UT> LowerReturn<UT> for Option<T>)