ContinuallyRan

Trait ContinuallyRan 

Source
pub trait ContinuallyRan: Sized + Send {
    const DELAY_BETWEEN_ITERATIONS: u64 = 5u64;
    const MAX_DELAY_BETWEEN_ITERATIONS: u64 = 120u64;

    // Required method
    fn run_iteration(
        &mut self,
    ) -> impl Send + Future<Output = Result<bool, String>>;

    // Provided method
    fn continually_run(
        self,
        task: Task,
        dependents: Vec<TaskHandle>,
    ) -> impl Send + Future<Output = ()> { ... }
}
Expand description

A task to be continually ran.

Provided Associated Constants§

Source

const DELAY_BETWEEN_ITERATIONS: u64 = 5u64

The amount of seconds before this task should be polled again.

Source

const MAX_DELAY_BETWEEN_ITERATIONS: u64 = 120u64

The maximum amount of seconds before this task should be run again.

Upon error, the amount of time waited will be linearly increased until this limit.

Required Methods§

Source

fn run_iteration(&mut self) -> impl Send + Future<Output = Result<bool, String>>

Run an iteration of the task.

If this returns true, all dependents of the task will immediately have a new iteration ran (without waiting for whatever timer they were already on).

Provided Methods§

Source

fn continually_run( self, task: Task, dependents: Vec<TaskHandle>, ) -> impl Send + Future<Output = ()>

Continually run the task.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§