minitimer 0.1.7

A mini timer of delayed tasks. Only asynchronous tasks are possible on tokio runtime, and dynamic add/cancel/remove is supported.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/// Trait for implementing custom task runners.
///
/// Users implement this trait to define what their scheduled task does.
/// The task runner is executed when the scheduled time arrives.
#[async_trait::async_trait]
pub trait TaskRunner: Send + Sync + 'static {
    /// The output type produced by the task runner.
    type Output: Send + 'static;

    /// Executes the task.
    ///
    /// # Returns
    /// * `Ok(Self::Output)` - On successful execution
    /// * `Err(Box<dyn std::error::Error + Send + Sync>)` - On failure
    async fn run(&self) -> Result<Self::Output, Box<dyn std::error::Error + Send + Sync>>;
}