pub struct Encoder { /* private fields */ }
Trait Implementations§
Source§impl<'cl> CuSrcTask<'cl> for Encoder
impl<'cl> CuSrcTask<'cl> for Encoder
type Output = &'cl mut CuMsg<EncoderPayload>
Source§fn new(config: Option<&ComponentConfig>) -> CuResult<Self>where
Self: Sized,
fn new(config: Option<&ComponentConfig>) -> CuResult<Self>where
Self: Sized,
Here you need to initialize everything your task will need for the duration of its lifetime.
The config allows you to access the configuration of the task.
Source§fn start(&mut self, clock: &RobotClock) -> CuResult<()>
fn start(&mut self, clock: &RobotClock) -> CuResult<()>
Start is called between the creation of the task and the first call to pre/process.
Source§fn process(&mut self, clock: &RobotClock, new_msg: Self::Output) -> CuResult<()>
fn process(&mut self, clock: &RobotClock, new_msg: Self::Output) -> CuResult<()>
Process is the most critical execution of the task.
The goal will be to produce the output message as soon as possible.
Use preprocess to prepare the task to make this method as short as possible.
Source§fn stop(&mut self, _clock: &RobotClock) -> CuResult<()>
fn stop(&mut self, _clock: &RobotClock) -> CuResult<()>
Called to stop the task. It signals that the *process method won’t be called until start is called again.
Source§fn 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.
Source§fn 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.
Source§impl Freezable for Encoder
impl Freezable for Encoder
Source§fn freeze<E>(&self, encoder: &mut E) -> Result<(), EncodeError>where
E: Encoder,
fn freeze<E>(&self, encoder: &mut E) -> Result<(), EncodeError>where
E: Encoder,
This method is called by the framework when it wants to save the task state.
The default implementation is to encode nothing (stateless).
If you have a state, you need to implement this method.
Source§fn thaw<D>(&mut self, decoder: &mut D) -> Result<(), DecodeError>where
D: Decoder,
fn thaw<D>(&mut self, decoder: &mut D) -> Result<(), DecodeError>where
D: Decoder,
This method is called by the framework when it wants to restore the task to a specific state.
Here it is similar to Decode but the framework will give you a new instance of the task (the new method will be called)
Auto Trait Implementations§
impl Freeze for Encoder
impl !RefUnwindSafe for Encoder
impl Send for Encoder
impl Sync for Encoder
impl Unpin for Encoder
impl !UnwindSafe for Encoder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more