Skip to main content

Module

Trait Module 

Source
pub trait Module {
    // Provided methods
    fn pre_timer(&mut self, _timer: TimerInfo) -> Result<Progress> { ... }
    fn post_timer(&mut self, _timer: TimerInfo) -> Result<Progress> { ... }
    fn warning(&mut self, _error: &Error) -> Result<()> { ... }
    fn reset(&mut self) -> Result<()> { ... }
}
Expand description

A generic module that controls whether timers should execute or not (outside of the normal timer)

Provided Methods§

Source

fn pre_timer(&mut self, _timer: TimerInfo) -> Result<Progress>

Decides if a timer should be allowed to execute

Source

fn post_timer(&mut self, _timer: TimerInfo) -> Result<Progress>

Decides what happens after a timer has executed

Source

fn warning(&mut self, _error: &Error) -> Result<()>

Is called when there’s a potentially recoverable error. Can re-throw an unrecoverable error.

Source

fn reset(&mut self) -> Result<()>

If this is called, the counting was reset - clear any cache here

Trait Implementations§

Source§

impl Module for Box<dyn Module>

Source§

fn pre_timer(&mut self, timer: TimerInfo) -> Result<Progress>

Decides if a timer should be allowed to execute
Source§

fn post_timer(&mut self, timer: TimerInfo) -> Result<Progress>

Decides what happens after a timer has executed
Source§

fn warning(&mut self, error: &Error) -> Result<()>

Is called when there’s a potentially recoverable error. Can re-throw an unrecoverable error.
Source§

fn reset(&mut self) -> Result<()>

If this is called, the counting was reset - clear any cache here

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Module for ()

The default module is also the unit type because why not

Source§

fn warning(&mut self, error: &Error) -> Result<()>

Source§

impl Module for Box<dyn Module>

Source§

fn pre_timer(&mut self, timer: TimerInfo) -> Result<Progress>

Source§

fn post_timer(&mut self, timer: TimerInfo) -> Result<Progress>

Source§

fn warning(&mut self, error: &Error) -> Result<()>

Source§

fn reset(&mut self) -> Result<()>

Source§

impl<A, B> Module for (A, B)
where A: Module, B: Module,

Combine two timers using the type-system. Can be recursed for a fixed-size amount of timers. Similar to iterator.chain.

Source§

fn pre_timer(&mut self, timer: TimerInfo) -> Result<Progress>

Source§

fn post_timer(&mut self, timer: TimerInfo) -> Result<Progress>

Source§

fn warning(&mut self, error: &Error) -> Result<()>

Source§

fn reset(&mut self) -> Result<()>

Source§

impl<M: Module> Module for Vec<M>

Combine multiple modules with a dynamic size

Source§

fn pre_timer(&mut self, timer: TimerInfo) -> Result<Progress>

Source§

fn post_timer(&mut self, timer: TimerInfo) -> Result<Progress>

Source§

fn warning(&mut self, error: &Error) -> Result<()>

Source§

fn reset(&mut self) -> Result<()>

Implementors§