pub struct HashedWheelBuilder { /* private fields */ }
Expand description
Builder for configuring different options for a HashedWheel
.
Implementations§
Source§impl HashedWheelBuilder
impl HashedWheelBuilder
Sourcepub fn with_tick_duration(self, duration: Duration) -> HashedWheelBuilder
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.
Sourcepub fn with_num_slots(self, num_slots: usize) -> HashedWheelBuilder
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.
Sourcepub fn with_init_capacity(self, init_capacity: usize) -> HashedWheelBuilder
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.
Sourcepub fn with_max_capacity(self, max_capacity: usize) -> HashedWheelBuilder
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.
Sourcepub fn with_max_timeout(self, timeout: Duration) -> HashedWheelBuilder
pub fn with_max_timeout(self, timeout: Duration) -> HashedWheelBuilder
Sets the maximum timeout for any timer.
Defaults to tick_duration * num_slots
.
Sourcepub fn tick_duration(&self) -> Duration
pub fn tick_duration(&self) -> Duration
Get the tick duration that was set.
Sourcepub fn init_capacity(&self) -> usize
pub fn init_capacity(&self) -> usize
Get the initial capacity for timer storage that was set.
Sourcepub fn max_capacity(&self) -> usize
pub fn max_capacity(&self) -> usize
Get the maximum capacity for timer storage that was set.
Sourcepub fn max_timeout(&self) -> Duration
pub fn max_timeout(&self) -> Duration
Get the maximum timeout that was set.
Sourcepub fn build<T>(self) -> HashedWheel<T>
pub fn build<T>(self) -> HashedWheel<T>
Build a new HashedWheel
from the current builder.