Struct tokio_timer::Builder
[−]
[src]
pub struct Builder { /* fields omitted */ }
Configures and builds a Timer
A Builder
is obtained by calling wheel()
.
Methods
impl Builder
[src]
fn tick_duration(self, tick_duration: Duration) -> Self
Set the timer tick duration.
See the crate docs for more detail.
Defaults to 100ms.
fn num_slots(self, num_slots: usize) -> Self
Set the number of slots in the timer wheel.
The number of slots must be a power of two.
See the crate docs for more detail.
Defaults to 4,096.
fn initial_capacity(self, initial_capacity: usize) -> Self
Set the initial capacity of the timer
The timer's timeout storage vector will be initialized to this
capacity. When the capacity is reached, the storage will be doubled
until max_capacity
is reached.
Default: 128
fn max_capacity(self, max_capacity: usize) -> Self
Set the max capacity of the timer
The timer's timeout storage vector cannot get larger than this capacity setting.
Default: 4,194,304
fn max_timeout(self, max_timeout: Duration) -> Self
Set the max timeout duration that can be requested
Setting the max timeout allows preventing the case of timeout collision in the hash wheel and helps guarantee optimial runtime characteristics.
See the crate docs for more detail.
Defaults to num_slots * tick_duration
fn channel_capacity(self, channel_capacity: usize) -> Self
Set the timer communication channel capacity
The timer channel is used to dispatch timeout requests to the timer thread. In theory, the timer thread is able to drain the channel at a very fast rate, however it is always possible for the channel to fill up.
This setting indicates the max number of timeout requests that are able to be buffered before timeout requests are rejected.
Defaults to 128
fn build(self) -> Timer
Build the configured Timer
and return a handle to it.