pub trait CuSinkTask: Freezable {
type Input<'m>: CuMsgPack;
type Resources<'r>;
// Required methods
fn new_with(
_config: Option<&ComponentConfig>,
_resources: Self::Resources<'_>,
) -> Result<Self, CuError>
where Self: Sized;
fn process<'i>(
&mut self,
_clock: &RobotClock,
input: &Self::Input<'i>,
) -> Result<(), CuError>;
// Provided methods
fn new(_config: Option<&ComponentConfig>) -> Result<Self, CuError>
where Self: Sized,
Self::Resources<'r>: for<'r> Default { ... }
fn start(&mut self, _clock: &RobotClock) -> Result<(), CuError> { ... }
fn preprocess(&mut self, _clock: &RobotClock) -> Result<(), CuError> { ... }
fn postprocess(&mut self, _clock: &RobotClock) -> Result<(), CuError> { ... }
fn stop(&mut self, _clock: &RobotClock) -> Result<(), CuError> { ... }
}Expand description
A Sink Task is a task that only consumes messages. For example drivers for actuators are Sink Tasks.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn new(_config: Option<&ComponentConfig>) -> Result<Self, CuError>
fn new(_config: Option<&ComponentConfig>) -> Result<Self, CuError>
Backward-compatible constructor for tasks that do not require resources.
Sourcefn start(&mut self, _clock: &RobotClock) -> Result<(), CuError>
fn start(&mut self, _clock: &RobotClock) -> Result<(), CuError>
Start is called between the creation of the task and the first call to pre/process.
Sourcefn preprocess(&mut self, _clock: &RobotClock) -> Result<(), CuError>
fn preprocess(&mut self, _clock: &RobotClock) -> Result<(), CuError>
This is a method called by the runtime before “process”. This is a kind of best effort, as soon as possible call to give a chance for the task to do some work before to prepare to make “process” as short as possible.
Sourcefn postprocess(&mut self, _clock: &RobotClock) -> Result<(), CuError>
fn postprocess(&mut self, _clock: &RobotClock) -> Result<(), CuError>
This is a method called by the runtime after “process”. It is best effort a chance for the task to update some state after process is out of the way. It can be use for example to maintain statistics etc. that are not time-critical for the robot.
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.