pub struct TimerPoller<S = Box<dyn Handler<Instant>>, Store = UnboundedSlab<WheelEntry<S>>> { /* private fields */ }Expand description
Timer driver poller — generic over handler storage and slab store.
Returned by TimerInstaller::install. Holds a pre-resolved
ResourceId for the wheel and a reusable drain buffer.
Store is the slab backend — determines which TimerWheel<S, Store>
resource to look up in the World. Defaults to the unbounded slab.
Implementations§
Source§impl<S, Store> TimerPoller<S, Store>
impl<S, Store> TimerPoller<S, Store>
Sourcepub fn poll(&mut self, world: &mut World, now: Instant) -> usize
pub fn poll(&mut self, world: &mut World, now: Instant) -> usize
Poll expired timers — drain from wheel, fire each handler, done.
Each handler receives now as its event. Handlers that need to
reschedule themselves do so directly via the wheel resource.
Returns the number of timers fired.
Sourcepub fn next_deadline(&self, world: &World) -> Option<Instant>
pub fn next_deadline(&self, world: &World) -> Option<Instant>
Earliest deadline in the wheel.
Trait Implementations§
Auto Trait Implementations§
impl<S, Store> Freeze for TimerPoller<S, Store>
impl<S, Store> RefUnwindSafe for TimerPoller<S, Store>where
S: RefUnwindSafe,
impl<S, Store> Send for TimerPoller<S, Store>where
S: Send,
impl<S = Box<dyn Handler<Instant>>, Store = Slab<WheelEntry<S>>> !Sync for TimerPoller<S, Store>
impl<S, Store> Unpin for TimerPoller<S, Store>where
S: Unpin,
impl<S, Store> UnsafeUnpin for TimerPoller<S, Store>
impl<S, Store> UnwindSafe for TimerPoller<S, Store>where
S: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more