Skip to main content

Task

Trait Task 

Source
pub trait Task:
    Check
    + Display
    + Send
    + Sync {
    // Required methods
    fn async_run<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<(), TaskError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn task<'async_trait>(
        self: Box<Self>,
    ) -> Pin<Box<dyn Future<Output = Result<(), TaskError>> + Send + 'async_trait>>
       where Self: 'async_trait;
    fn as_plain(&self) -> PlainActor;

    // Provided methods
    fn spawn(self) -> JoinHandle<Result<(), TaskError>>
       where Self: Sized + 'static { ... }
    fn name(&self) -> &'static str { ... }
}
Expand description

Interface for running model components

Required Methods§

Source

fn async_run<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), TaskError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Runs the Actor infinite loop

The loop ends when the client data is None or when either the sending of receiving end of a channel is dropped

Source

fn task<'async_trait>( self: Box<Self>, ) -> Pin<Box<dyn Future<Output = Result<(), TaskError>> + Send + 'async_trait>>
where Self: 'async_trait,

Run the actor loop

Source

fn as_plain(&self) -> PlainActor

Provided Methods§

Source

fn spawn(self) -> JoinHandle<Result<(), TaskError>>
where Self: Sized + 'static,

Run the actor loop in a dedicated thread

Source

fn name(&self) -> &'static str

Trait Implementations§

Source§

impl FromIterator<Box<dyn Task>> for Model<Unknown>

Source§

fn from_iter<T: IntoIterator<Item = Box<dyn Task>>>(iter: T) -> Self

Creates a value from an iterator. Read more

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<C, const NI: usize, const NO: usize> Task for Actor<C, NI, NO>
where C: 'static + TryUpdate,

Source§

impl<T> Task for Sys<T>
where T: System, for<'a> &'a T: IntoIterator<Item = Box<&'a dyn Check>>, Box<T>: IntoIterator<Item = Box<dyn Task>>,