pub trait Timer: 'static {
// Required methods
fn name(&self) -> &str;
fn run(&self);
// Provided methods
fn run_before(&self) -> bool { ... }
fn ended(&self) -> bool { ... }
fn interval(&self) -> Option<Duration> { ... }
fn start(self)
where Self: Sized { ... }
}Expand description
timer tasks
Required Methods§
Provided Methods§
Sourcefn run_before(&self) -> bool
fn run_before(&self) -> bool
ren before, default return true
please execute the non blocking logic that ends immediately
do nothing when return false
execute Self::run in the thread pool when return true
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl Timer for SimpleTimer
support timer