Struct ferris::AllocWheel
[−]
[src]
pub struct AllocWheel<T: Eq + Hash + Debug + Clone> { /* fields omitted */ }
This wheel requires an allocation for each timer as it creates an RcWeak<T>
is stored
in the wheel slot, so that if the timer is cancelled, the memory is de-allocatd. When the expiry
for that slot comes around, an attempt to promote the Weak reference will return None
and so
it will be ignored when draining the wheel slot. If the timer expires before it is cancelled,
the weak reference can be used to remove the Rc
The minimum duration of a timer is 1 ms. The maximum duration of a timer is 1 day.
Methods
impl<T: Eq + Hash + Debug + Clone> AllocWheel<T>
[src]
fn new(resolutions: Vec<Resolution>) -> AllocWheel<T>
Create a set of hierarchical inner wheels
The wheel must be driven by calling expire
at the maximum resolution.
For example if the maximum resolution is 10ms, then expire must be called every 10ms.
The maximum value of the wheel is its minimum resolution times the number of slots in that resolution's wheel. For example if the maximum resolution is 1 second then the max timer that may be represented is 1 minute, since the second wheel always only contains 60 slots. If larger timer durations are desired, the user should add another, lower resolution. The absolute maximum timer duration is 1 day.