pub trait Mechtron<P>: MechtronLifecycle<P> + Sync + Send + 'staticwhere
P: Platform,{
type Skel;
type Cache;
type State;
fn restore(skel: Self::Skel, cache: Self::Cache, state: Self::State) -> Self;
fn cache(_skel: Self::Skel) -> Result<Option<Self::Cache>, P::Err> { ... }
}
Expand description
Create a Mechtron by implementing this trait. Mechtrons are created per request and disposed of afterwards… Implementers of this trait should only hold references to Mechtron::Skel, Mechtron::Cache & Mechtron::State at most.
Required Associated Types
sourcetype Skel
type Skel
it is recommended to implement MechtronSkel or some derivative
of MechtronSkel. Skel holds info about the Mechtron (like it’s Point,
exact Kind & Properties) The Skel may also provide access to other
services within the Guest. If your Mechtron doesn’t use the Skel
then implement type Skel=()