Trait tokio_tasks::TaskBase

source ·
pub trait TaskBase: Send + Sync {
    // Required methods
    fn shutdown_order(&self) -> i32;
    fn name(&self) -> &str;
    fn id(&self) -> usize;
    fn main(&self) -> bool;
    fn abort(&self) -> bool;
    fn critical(&self) -> bool;
    fn start_time(&self) -> f64;
    fn cancel(self: Arc<Self>) -> BoxFuture<'static, ()>;
    fn run_token(&self) -> &RunToken;
    fn no_shutdown(&self) -> bool;
}
Expand description

Base trait for all tasks, that is independent of the return type

Required Methods§

source

fn shutdown_order(&self) -> i32

Return the shutdown order of this task as defined by the TaskBuilder

source

fn name(&self) -> &str

Return the name of this task as defined by the TaskBuilder

source

fn id(&self) -> usize

Return the unique id of this task

source

fn main(&self) -> bool

If true the application will shut down with an error if this task returns

source

fn abort(&self) -> bool

If this is true the task will be cancled by dropping the future instead of signaling the run token

source

fn critical(&self) -> bool

If true the application will shut down with an error if this task returns with an error

source

fn start_time(&self) -> f64

Unixtimestamp of when the task started

source

fn cancel(self: Arc<Self>) -> BoxFuture<'static, ()>

Cantle the task, return futer that returns when the task is done

source

fn run_token(&self) -> &RunToken

Get the run token associated with the task

source

fn no_shutdown(&self) -> bool

Do not stop task on shutdown

Implementors§

source§

impl<T: Send + Sync + 'static, E: Send + Sync + 'static> TaskBase for Task<T, E>