Trait gmt_dos_actors::framework::model::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 method
    fn spawn(self) -> JoinHandle<Result<(), TaskError>>
       where Self: Sized + 'static { ... }
}
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

Implementors§

source§

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

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>>,