pub struct RetryQueue<T> { /* private fields */ }Expand description
Thread-safe retry queue for items of type T.
Implementations§
Source§impl<T: Clone> RetryQueue<T>
impl<T: Clone> RetryQueue<T>
Sourcepub fn new(config: RetryConfig) -> Self
pub fn new(config: RetryConfig) -> Self
Create a new retry queue with the given configuration.
Sourcepub fn enqueue(&self, item: T, attempts: u32) -> bool
pub fn enqueue(&self, item: T, attempts: u32) -> bool
Enqueue an item for retry. If attempts exceeds max_attempts,
the item is NOT enqueued and false is returned (dead-letter).
Sourcepub fn drain_ready(&self) -> Vec<RetryEntry<T>>
pub fn drain_ready(&self) -> Vec<RetryEntry<T>>
Dequeue all items that are ready for retry. Clears them from the queue.
Sourcepub fn config(&self) -> &RetryConfig
pub fn config(&self) -> &RetryConfig
Get the configuration.
Auto Trait Implementations§
impl<T> !Freeze for RetryQueue<T>
impl<T> RefUnwindSafe for RetryQueue<T>
impl<T> Send for RetryQueue<T>where
T: Send,
impl<T> Sync for RetryQueue<T>where
T: Send,
impl<T> Unpin for RetryQueue<T>where
T: Unpin,
impl<T> UnsafeUnpin for RetryQueue<T>
impl<T> UnwindSafe for RetryQueue<T>
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