CuSimSinkTask

Struct CuSimSinkTask 

Source
pub struct CuSimSinkTask<T> { /* private fields */ }
Expand description

This is a placeholder task for a sink task for the simulations. It basically does nothing in place of a real driver so it won’t try to initialize any hardware.

Trait Implementations§

Source§

impl<T> CuSinkTask for CuSimSinkTask<T>
where T: CuMsgPayload,

Source§

type Input<'m> = CuStampedData<T, CuMsgMetadata>

Source§

fn new(_config: Option<&ComponentConfig>) -> Result<CuSimSinkTask<T>, CuError>
where CuSimSinkTask<T>: 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 process( &mut self, _clock: &RobotClock, _input: &<CuSimSinkTask<T> as CuSinkTask>::Input<'_>, ) -> Result<(), CuError>

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 start(&mut self, _clock: &RobotClock) -> Result<(), CuError>

Start is called between the creation of the task and the first call to pre/process.
Source§

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>

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§

fn stop(&mut self, _clock: &RobotClock) -> Result<(), CuError>

Called to stop the task. It signals that the *process method won’t be called until start is called again.
Source§

impl<T> Freezable for CuSimSinkTask<T>
where T: CuMsgPayload,

Source§

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,

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<T> Freeze for CuSimSinkTask<T>

§

impl<T> RefUnwindSafe for CuSimSinkTask<T>
where T: RefUnwindSafe,

§

impl<T> Send for CuSimSinkTask<T>
where T: Send,

§

impl<T> Sync for CuSimSinkTask<T>
where T: Sync,

§

impl<T> Unpin for CuSimSinkTask<T>
where T: Unpin,

§

impl<T> UnwindSafe for CuSimSinkTask<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> ErasedDestructor for T
where T: 'static,