[][src]Struct freertos_rs::patterns::compute_task::ComputeTask

pub struct ComputeTask<R> { /* fields omitted */ }

A task that can terminate and return its return value. Implemented using an atomically shared mutex.

Sample usage:

use freertos_rs::patterns::compute_task::*;
let task = Task::new().compute(|| {

let result = task.into_result(Duration::ms(1000)).unwrap();


impl<R: Debug> ComputeTask<R>[src]

pub fn get_task(&self) -> &Task[src]

Get the handle of the task that computes the result.

pub fn wait_for_result<D: DurationTicks>(
    &mut self,
    max_wait: D
) -> Result<(), FreeRtosError>

Wait until the task computes its result. Otherwise, returns a timeout.

pub fn into_result<D: DurationTicks>(
    max_wait: D
) -> Result<R, FreeRtosError>

Consume the task and unwrap the computed return value.

Auto Trait Implementations

impl<R> Send for ComputeTask<R> where
    R: Send + Sync

impl<R> !Sync for ComputeTask<R>

Blanket Implementations

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

type Error = Infallible

The type returned in the event of a conversion error.

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

impl<T> From<T> for T[src]

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

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

The type returned in the event of a conversion error.

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

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

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