AsyncMethodHandler

Trait AsyncMethodHandler 

Source
pub trait AsyncMethodHandler: Sized + 'static {
    // Required method
    fn on_method_call<'life0, 'async_trait>(
        &'life0 self,
        call: MethodCall,
    ) -> Pin<Box<dyn Future<Output = PlatformResult> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn assign_weak_self(&self, _weak_self: Weak<Self>) { ... }
    fn assign_invoker(&self, _invoker: AsyncMethodInvoker) { ... }
    fn on_isolate_destroyed(&self, _engine: IsolateId) { ... }
    fn register(self, channel: &str) -> RegisteredAsyncMethodHandler<Self> { ... }
}

Required Methods§

Source

fn on_method_call<'life0, 'async_trait>( &'life0 self, call: MethodCall, ) -> Pin<Box<dyn Future<Output = PlatformResult> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Provided Methods§

Source

fn assign_weak_self(&self, _weak_self: Weak<Self>)

Implementation can store weak reference if it needs to pass it around. Guaranteed to call before any other methods.

Note: You can use crate::util::Late to store the weak reference.

Source

fn assign_invoker(&self, _invoker: AsyncMethodInvoker)

Keep the method invoker provider if you want to call methods on engines.

Note: You can use crate::util::Late to store the invoker.

Source

fn on_isolate_destroyed(&self, _engine: IsolateId)

Called when engine is about to be destroyed.

Source

fn register(self, channel: &str) -> RegisteredAsyncMethodHandler<Self>

Registers itself for handling platform channel methods.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§