Struct HashedWheelBuilder

Source
pub struct HashedWheelBuilder { /* private fields */ }
Expand description

Builder for configuring different options for a HashedWheel.

Implementations§

Source§

impl HashedWheelBuilder

Source

pub fn with_tick_duration(self, duration: Duration) -> HashedWheelBuilder

Sets the tick duration which sets the resolution for the timer.

Any timeouts will be rounded up based on the tick duration.

Source

pub fn with_num_slots(self, num_slots: usize) -> HashedWheelBuilder

Sets the number of slots used for ticks.

Controls how many slots we have for timeouts. The less number of collisions there are (where a collision is when two or more items in the same slot have different timeouts), the more efficient operations we can perform.

Source

pub fn with_init_capacity(self, init_capacity: usize) -> HashedWheelBuilder

Sets the initial capacity for timer storage.

This is the number of timeouts we can initially store.

Source

pub fn with_max_capacity(self, max_capacity: usize) -> HashedWheelBuilder

Sets the maximum capacity for timer storage.

This is the maximum number of timeouts we can ever store.

Source

pub fn with_max_timeout(self, timeout: Duration) -> HashedWheelBuilder

Sets the maximum timeout for any timer.

Defaults to tick_duration * num_slots.

Source

pub fn tick_duration(&self) -> Duration

Get the tick duration that was set.

Source

pub fn num_slots(&self) -> usize

Get the number of slots that were set.

Source

pub fn init_capacity(&self) -> usize

Get the initial capacity for timer storage that was set.

Source

pub fn max_capacity(&self) -> usize

Get the maximum capacity for timer storage that was set.

Source

pub fn max_timeout(&self) -> Duration

Get the maximum timeout that was set.

Source

pub fn build<T>(self) -> HashedWheel<T>

Build a new HashedWheel from the current builder.

Trait Implementations§

Source§

impl Default for HashedWheelBuilder

Source§

fn default() -> HashedWheelBuilder

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

impl<T> From<HashedWheelBuilder> for HashedWheel<T>

Source§

fn from(builder: HashedWheelBuilder) -> HashedWheel<T>

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.