pub struct ForeignExecutor { /* private fields */ }
Expand description
Reexport items from other uniffi creates Schedule Rust calls using a foreign executor
Implementations§
Source§impl ForeignExecutor
impl ForeignExecutor
pub fn new(executor: ForeignExecutorHandle) -> ForeignExecutor
Sourcepub fn schedule<F>(&self, delay: u32, task: F)
pub fn schedule<F>(&self, delay: u32, task: F)
Schedule a closure to be run.
This method can be used for “fire-and-forget” style calls, where the calling code doesn’t need to await the result.
Closure requirements:
- Send: since the closure will likely run on a different thread
- ’static: since it runs at an arbitrary time, so all references need to be ’static
- panic::UnwindSafe: if the closure panics, it should not corrupt any data
Sourcepub async fn run<F, T>(&self, delay: u32, closure: F) -> T
pub async fn run<F, T>(&self, delay: u32, closure: F) -> T
Schedule a closure to be run and get a Future for the result
Closure requirements:
- Send: since the closure will likely run on a different thread
- ’static: since it runs at an arbitrary time, so all references need to be ’static
- panic::UnwindSafe: if the closure panics, it should not corrupt any data
Trait Implementations§
Source§impl<UT> ConvertError<UT> for ForeignExecutor
impl<UT> ConvertError<UT> for ForeignExecutor
Source§impl Debug for ForeignExecutor
impl Debug for ForeignExecutor
Source§impl Drop for ForeignExecutor
impl Drop for ForeignExecutor
Source§impl<UT> FfiConverter<UT> for ForeignExecutor
FFI support for ForeignExecutor
impl<UT> FfiConverter<UT> for ForeignExecutor
FFI support for ForeignExecutor
These are passed over the FFI as opaque pointer-sized types representing the foreign executor. The foreign bindings may use an actual pointer to the executor object, or a usized integer handle.
Source§const TYPE_ID_META: MetadataBuffer
const TYPE_ID_META: MetadataBuffer
Type ID metadata, serialized into a MetadataBuffer. Read more
Source§type FfiType = ForeignExecutorHandle
type FfiType = ForeignExecutorHandle
The low-level type used for passing values of this type over the FFI. Read more
Source§fn lower(
executor: ForeignExecutor,
) -> <ForeignExecutor as FfiConverter<UT>>::FfiType
fn lower( executor: ForeignExecutor, ) -> <ForeignExecutor as FfiConverter<UT>>::FfiType
Lower a rust value of the target type, into an FFI value of type Self::FfiType. Read more
Source§fn write(executor: ForeignExecutor, buf: &mut Vec<u8>)
fn write(executor: ForeignExecutor, buf: &mut Vec<u8>)
Write a rust value into a buffer, to send over the FFI in serialized form. Read more
Source§fn try_lift(
executor: <ForeignExecutor as FfiConverter<UT>>::FfiType,
) -> Result<ForeignExecutor, Error>
fn try_lift( executor: <ForeignExecutor as FfiConverter<UT>>::FfiType, ) -> Result<ForeignExecutor, Error>
Lift a rust value of the target type, from an FFI value of type Self::FfiType. Read more
Source§impl<UT> Lift<UT> for ForeignExecutor
impl<UT> Lift<UT> for ForeignExecutor
const TYPE_ID_META: MetadataBuffer
type FfiType = <ForeignExecutor as FfiConverter<UT>>::FfiType
fn try_lift( v: <ForeignExecutor as Lift<UT>>::FfiType, ) -> Result<ForeignExecutor, Error>
fn try_read(buf: &mut &[u8]) -> Result<ForeignExecutor, Error>
Source§fn try_lift_from_rust_buffer(v: RustBuffer) -> Result<Self, Error>
fn try_lift_from_rust_buffer(v: RustBuffer) -> Result<Self, Error>
Convenience method
Source§impl<UT> LiftRef<UT> for ForeignExecutor
impl<UT> LiftRef<UT> for ForeignExecutor
type LiftType = ForeignExecutor
Source§impl<UT> LiftReturn<UT> for ForeignExecutor
impl<UT> LiftReturn<UT> for ForeignExecutor
const TYPE_ID_META: MetadataBuffer
Source§fn lift_callback_return(buf: RustBuffer) -> ForeignExecutor
fn lift_callback_return(buf: RustBuffer) -> ForeignExecutor
Lift a Rust value for a callback interface method result
Source§fn lift_callback_error(_buf: RustBuffer) -> Self
fn lift_callback_error(_buf: RustBuffer) -> Self
Lift a Rust value for a callback interface method error result Read more
Source§fn handle_callback_unexpected_error(e: UnexpectedUniFFICallbackError) -> Self
fn handle_callback_unexpected_error(e: UnexpectedUniFFICallbackError) -> Self
Lift a Rust value for an unexpected callback interface error Read more
Source§impl<UT> Lower<UT> for ForeignExecutor
impl<UT> Lower<UT> for ForeignExecutor
const TYPE_ID_META: MetadataBuffer
type FfiType = <ForeignExecutor as FfiConverter<UT>>::FfiType
fn lower(obj: ForeignExecutor) -> <ForeignExecutor as Lower<UT>>::FfiType
fn write(obj: ForeignExecutor, buf: &mut Vec<u8>)
Source§fn lower_into_rust_buffer(obj: Self) -> RustBuffer
fn lower_into_rust_buffer(obj: Self) -> RustBuffer
Convenience method
Source§impl<UT> LowerReturn<UT> for ForeignExecutor
impl<UT> LowerReturn<UT> for ForeignExecutor
const TYPE_ID_META: MetadataBuffer
Source§type ReturnType = <ForeignExecutor as Lower<UT>>::FfiType
type ReturnType = <ForeignExecutor as Lower<UT>>::FfiType
The type that should be returned by scaffolding functions for this type. Read more
Source§fn lower_return(
obj: ForeignExecutor,
) -> Result<<ForeignExecutor as LowerReturn<UT>>::ReturnType, RustBuffer>
fn lower_return( obj: ForeignExecutor, ) -> Result<<ForeignExecutor as LowerReturn<UT>>::ReturnType, RustBuffer>
Lower this value for scaffolding function return Read more
Auto Trait Implementations§
impl Freeze for ForeignExecutor
impl RefUnwindSafe for ForeignExecutor
impl Send for ForeignExecutor
impl Sync for ForeignExecutor
impl Unpin for ForeignExecutor
impl UnwindSafe for ForeignExecutor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more