pub struct SleepTracker<T> {
heap: BinaryHeap<Sleeper<T>>,
}
Expand description
A tracker for network requests that have failed, and are awaiting to be retried in the future.
Fields§
§heap: BinaryHeap<Sleeper<T>>
This is a priority queue that tracks the time when the next sleeper
should awaken (based on the Sleeper::wakeup
property).
Implementations§
Source§impl<T> SleepTracker<T>
impl<T> SleepTracker<T>
pub fn new() -> SleepTracker<T>
Sourcepub fn push(&mut self, sleep: u64, data: T)
pub fn push(&mut self, sleep: u64, data: T)
Adds a new download that should be retried in the future.
pub fn len(&self) -> usize
Sourcepub fn time_to_next(&self) -> Option<Duration>
pub fn time_to_next(&self) -> Option<Duration>
Returns the time when the next download is ready to go.
Returns None if there are no sleepers remaining.
Auto Trait Implementations§
impl<T> Freeze for SleepTracker<T>
impl<T> RefUnwindSafe for SleepTracker<T>where
T: RefUnwindSafe,
impl<T> Send for SleepTracker<T>where
T: Send,
impl<T> Sync for SleepTracker<T>where
T: Sync,
impl<T> Unpin for SleepTracker<T>where
T: Unpin,
impl<T> UnwindSafe for SleepTracker<T>where
T: 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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 24 bytes