BitWheel

Struct BitWheel 

Source
pub struct BitWheel<T, const NUM_GEARS: usize = DEFAULT_GEARS, const RESOLUTION_MS: u64 = DEFAULT_RESOLUTION_MS, const SLOT_CAP: usize = DEFAULT_SLOT_CAP, const MAX_PROBES: usize = DEFAULT_MAX_PROBES> { /* private fields */ }

Implementations§

Source§

impl<T, const NUM_GEARS: usize, const RESOLUTION_MS: u64, const SLOT_CAP: usize, const MAX_PROBES: usize> BitWheel<T, NUM_GEARS, RESOLUTION_MS, SLOT_CAP, MAX_PROBES>

Source

pub fn with_epoch(epoch: Instant) -> Self

Source

pub fn new() -> Self

Source

pub fn boxed() -> Box<Self>

Source

pub fn boxed_with_epoch(epoch: Instant) -> Box<Self>

Source

pub const fn gear_granularities() -> [u64; NUM_GEARS]

Useful for deciding how to scale the BitWheel for your use case such that it satisfies the timer constraints.

Source

pub const fn memory_footprint() -> usize

Useful for deciding how to scale the BitWheel for your use case such that it does not take up a tremendous amount of memory.

Source

pub fn duration_until_next(&self) -> Option<Duration>

Source

pub fn is_empty(&self) -> bool

Source

pub fn insert( &mut self, when: Instant, timer: T, ) -> Result<TimerHandle, InsertError<T>>

Source

pub fn cancel(&mut self, handle: TimerHandle) -> Option<T>

Source

pub fn poll( &mut self, now: Instant, ctx: &mut T::Context, ) -> Result<usize, PollError>
where T: Timer,

Trait Implementations§

Source§

impl<T, const NUM_GEARS: usize, const RESOLUTION_MS: u64, const SLOT_CAP: usize, const MAX_PROBES: usize> Default for BitWheel<T, NUM_GEARS, RESOLUTION_MS, SLOT_CAP, MAX_PROBES>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T, const G: usize, const R: u64, const S: usize, const P: usize> TimerDriver<T> for BitWheel<T, G, R, S, P>
where T: Timer,

Source§

fn insert( &mut self, when: Instant, timer: T, ) -> Result<TimerHandle, InsertError<T>>

Insert a timer to fire at the given instant. Read more
Source§

fn cancel(&mut self, handle: TimerHandle) -> Option<T>

Cancel a pending timer. Read more
Source§

fn poll( &mut self, now: Instant, ctx: &mut T::Context, ) -> Result<usize, PollError>

Poll the wheel, firing all timers due by now. Read more

Auto Trait Implementations§

§

impl<T, const NUM_GEARS: usize = DEFAULT_GEARS, const RESOLUTION_MS: u64 = DEFAULT_RESOLUTION_MS, const SLOT_CAP: usize = DEFAULT_SLOT_CAP, const MAX_PROBES: usize = DEFAULT_MAX_PROBES> !Freeze for BitWheel<T, NUM_GEARS, RESOLUTION_MS, SLOT_CAP, MAX_PROBES>

§

impl<T, const NUM_GEARS: usize = DEFAULT_GEARS, const RESOLUTION_MS: u64 = DEFAULT_RESOLUTION_MS, const SLOT_CAP: usize = DEFAULT_SLOT_CAP, const MAX_PROBES: usize = DEFAULT_MAX_PROBES> !RefUnwindSafe for BitWheel<T, NUM_GEARS, RESOLUTION_MS, SLOT_CAP, MAX_PROBES>

§

impl<T, const NUM_GEARS: usize, const RESOLUTION_MS: u64, const SLOT_CAP: usize, const MAX_PROBES: usize> Send for BitWheel<T, NUM_GEARS, RESOLUTION_MS, SLOT_CAP, MAX_PROBES>
where T: Send,

§

impl<T, const NUM_GEARS: usize = DEFAULT_GEARS, const RESOLUTION_MS: u64 = DEFAULT_RESOLUTION_MS, const SLOT_CAP: usize = DEFAULT_SLOT_CAP, const MAX_PROBES: usize = DEFAULT_MAX_PROBES> !Sync for BitWheel<T, NUM_GEARS, RESOLUTION_MS, SLOT_CAP, MAX_PROBES>

§

impl<T, const NUM_GEARS: usize, const RESOLUTION_MS: u64, const SLOT_CAP: usize, const MAX_PROBES: usize> Unpin for BitWheel<T, NUM_GEARS, RESOLUTION_MS, SLOT_CAP, MAX_PROBES>

§

impl<T, const NUM_GEARS: usize, const RESOLUTION_MS: u64, const SLOT_CAP: usize, const MAX_PROBES: usize> UnwindSafe for BitWheel<T, NUM_GEARS, RESOLUTION_MS, SLOT_CAP, MAX_PROBES>
where T: UnwindSafe,

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.