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]
impl Builderpub fn tick_duration(self, tick_duration: Duration) -> Self[src]
pub fn tick_duration(self, tick_duration: Duration) -> SelfSet the timer tick duration.
See the crate docs for more detail.
Defaults to 100ms.
pub fn num_slots(self, num_slots: usize) -> Self[src]
pub fn num_slots(self, num_slots: usize) -> SelfSet 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.
pub fn initial_capacity(self, initial_capacity: usize) -> Self[src]
pub fn initial_capacity(self, initial_capacity: usize) -> SelfSet 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
pub fn max_capacity(self, max_capacity: usize) -> Self[src]
pub fn max_capacity(self, max_capacity: usize) -> SelfSet the max capacity of the timer
The timer's timeout storage vector cannot get larger than this capacity setting.
Default: 4,194,304
pub fn max_timeout(self, max_timeout: Duration) -> Self[src]
pub fn max_timeout(self, max_timeout: Duration) -> SelfSet 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
pub fn channel_capacity(self, channel_capacity: usize) -> Self[src]
pub fn channel_capacity(self, channel_capacity: usize) -> SelfSet 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
pub fn thread_name<S: Into<String>>(self, name: S) -> Self[src]
pub fn thread_name<S: Into<String>>(self, name: S) -> SelfSet the name for the spawned thread.
See also the runtime details in crate docs.
Defaults to "tokio-timer".
pub fn build(self) -> Timer[src]
pub fn build(self) -> TimerBuild the configured Timer and return a handle to it.