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§
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§
Sourcefn assign_weak_self(&self, _weak_self: Weak<Self>)
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.
Sourcefn assign_invoker(&self, _invoker: AsyncMethodInvoker)
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.
Sourcefn on_isolate_destroyed(&self, _engine: IsolateId)
fn on_isolate_destroyed(&self, _engine: IsolateId)
Called when engine is about to be destroyed.
Sourcefn register(self, channel: &str) -> RegisteredAsyncMethodHandler<Self>
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.