Trait Pendulum

Source
pub trait Pendulum<T> {
    // Required methods
    fn insert_timeout(
        &mut self,
        timeout: Duration,
        item: T,
    ) -> PendulumResult<Token, T>;
    fn remove_timeout(&mut self, token: Token) -> Option<T>;
    fn expired_timeout(&mut self) -> Option<T>;
    fn tick(&mut self);
    fn tick_duration(&self) -> Duration;
    fn max_capacity(&self) -> usize;
    fn max_timeout(&self) -> Duration;
}
Expand description

Trait for working with generic timer wheel implementations.

Required Methods§

Source

fn insert_timeout( &mut self, timeout: Duration, item: T, ) -> PendulumResult<Token, T>

Insert a timeout with the given duration and the given item into the Pendulum.

Source

fn remove_timeout(&mut self, token: Token) -> Option<T>

Removes the timeout corresponding with the given Token, if one exists.

Source

fn expired_timeout(&mut self) -> Option<T>

Retrieve the next expired timeout from the Pendulum.

This is a non-blocking operation.

Source

fn tick(&mut self)

Tick the Pendulum once.

Source

fn tick_duration(&self) -> Duration

Configured tick duration for this Pendulum.

Source

fn max_capacity(&self) -> usize

Configured max timeout capacity for this Pendulum.

Source

fn max_timeout(&self) -> Duration

Configured maximum timeout for this Pendulum.

Implementors§

Source§

impl<T> Pendulum<T> for HashedWheel<T>