pub trait Codelet: Send {
type Status: CodeletStatus;
type Config: Config + Send;
type Rx: RxBundle;
type Tx: TxBundle;
type Signals: Signals;
// Required method
fn build_bundles(cfg: &Self::Config) -> (Self::Rx, Self::Tx);
// Provided methods
fn start(
&mut self,
_cx: Context<'_, Self>,
_rx: &mut Self::Rx,
_tx: &mut Self::Tx,
) -> Result<Self::Status> { ... }
fn stop(
&mut self,
_cx: Context<'_, Self>,
_rx: &mut Self::Rx,
_tx: &mut Self::Tx,
) -> Result<Self::Status> { ... }
fn step(
&mut self,
_cx: Context<'_, Self>,
_rx: &mut Self::Rx,
_tx: &mut Self::Tx,
) -> Result<Self::Status> { ... }
fn pause(&mut self) -> Result<Self::Status> { ... }
fn resume(&mut self) -> Result<Self::Status> { ... }
}Expand description
Codelets can be implemented by the user to execute work.
Required Associated Types§
Sourcetype Status: CodeletStatus
type Status: CodeletStatus
Status code used to indicate health of codelet
Required Methods§
Sourcefn build_bundles(cfg: &Self::Config) -> (Self::Rx, Self::Tx)
fn build_bundles(cfg: &Self::Config) -> (Self::Rx, Self::Tx)
Constructs channel bundles
Provided Methods§
Sourcefn start(
&mut self,
_cx: Context<'_, Self>,
_rx: &mut Self::Rx,
_tx: &mut Self::Tx,
) -> Result<Self::Status>
fn start( &mut self, _cx: Context<'_, Self>, _rx: &mut Self::Rx, _tx: &mut Self::Tx, ) -> Result<Self::Status>
Start is guaranteed to be called first. Start may be called again after stop was called.
Sourcefn stop(
&mut self,
_cx: Context<'_, Self>,
_rx: &mut Self::Rx,
_tx: &mut Self::Tx,
) -> Result<Self::Status>
fn stop( &mut self, _cx: Context<'_, Self>, _rx: &mut Self::Rx, _tx: &mut Self::Tx, ) -> Result<Self::Status>
Stop is guaranteed to be called at the end if start was called.
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.