pub trait MethodHandler: Sized + 'static {
// Required method
fn on_method_call(&self, call: MethodCall, reply: MethodCallReply);
// Provided methods
fn assign_weak_self(&self, _weak_self: Weak<Self>) { ... }
fn assign_invoker(&self, _invoker: MethodInvoker) { ... }
fn on_isolate_destroyed(&self, _isolate: IsolateId) { ... }
fn register(self, channel: &str) -> RegisteredMethodHandler<Self> { ... }
}Required Methods§
fn on_method_call(&self, call: MethodCall, reply: MethodCallReply)
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 be called before any other methods.
Sourcefn assign_invoker(&self, _invoker: MethodInvoker)
fn assign_invoker(&self, _invoker: MethodInvoker)
Keep the method invoker if you want to call methods on engines.
Sourcefn on_isolate_destroyed(&self, _isolate: IsolateId)
fn on_isolate_destroyed(&self, _isolate: IsolateId)
Called when isolate is about to be destroyed.
Sourcefn register(self, channel: &str) -> RegisteredMethodHandler<Self>
fn register(self, channel: &str) -> RegisteredMethodHandler<Self>
Register self 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.