pub trait Instance: 'static {
// Required methods
async fn new(id: String, cfg: &InstanceConfig) -> Result<Self, Error>
where Self: Sized;
async fn start(&self) -> Result<u32, Error>;
async fn kill(&self, signal: u32) -> Result<(), Error>;
async fn delete(&self) -> Result<(), Error>;
async fn wait(&self) -> (u32, DateTime<Utc>);
}Expand description
Represents a WASI module(s).
Instance is a trait that gets implemented by consumers of this library.
This trait requires that any type implementing it is 'static, similar to std::any::Any.
This means that the type cannot contain a non-'static reference.
Required Methods§
Sourceasync fn new(id: String, cfg: &InstanceConfig) -> Result<Self, Error>where
Self: Sized,
async fn new(id: String, cfg: &InstanceConfig) -> Result<Self, Error>where
Self: Sized,
Create a new instance
Sourceasync fn start(&self) -> Result<u32, Error>
async fn start(&self) -> Result<u32, Error>
Start the instance The returned value should be a unique ID (such as a PID) for the instance. Nothing internally should be using this ID, but it is returned to containerd where a user may want to use it.
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.