pub trait NativeModule: Send + Sync {
// Required methods
fn identity(&self) -> &NativeIdentity;
fn operations(&self) -> &[&str];
fn capabilities(&self) -> &[&str];
fn start(
&self,
operation: &str,
arguments: Vec<Value>,
) -> Result<TaskId, Error>;
fn poll(&self, task: TaskId) -> Result<TaskEvent, Error>;
fn cancel(&self, task: TaskId) -> Result<(), Error>;
fn drop_task(&self, task: TaskId);
fn shutdown(&self);
// Provided method
fn wait(
&self,
task: TaskId,
timeout: Option<Duration>,
) -> Result<TaskEvent, Error> { ... }
}Expand description
Dependency-free contract implemented by publication-linked native crates.
Required Methods§
fn identity(&self) -> &NativeIdentity
fn operations(&self) -> &[&str]
fn capabilities(&self) -> &[&str]
fn start(&self, operation: &str, arguments: Vec<Value>) -> Result<TaskId, Error>
fn poll(&self, task: TaskId) -> Result<TaskEvent, Error>
fn cancel(&self, task: TaskId) -> Result<(), Error>
fn drop_task(&self, task: TaskId)
fn shutdown(&self)
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".