pub struct Queue<T: Serialize + DeserializeOwned> { /* private fields */ }
Expand description
A FIFO queue Optionally has a server side time to live
Implementations§
Source§impl<T: Serialize + DeserializeOwned> Queue<T>
impl<T: Serialize + DeserializeOwned> Queue<T>
Sourcepub async fn push_batch(&self, data: &[T]) -> Result<(), ErrorTypes>
pub async fn push_batch(&self, data: &[T]) -> Result<(), ErrorTypes>
enqueue a sequence of items
Sourcepub async fn unpop(&self, data: &T) -> Result<(), ErrorTypes>
pub async fn unpop(&self, data: &T) -> Result<(), ErrorTypes>
Put all messages passed back at the head of the FIFO queue.
Sourcepub async fn length(&self) -> Result<usize, ErrorTypes>
pub async fn length(&self) -> Result<usize, ErrorTypes>
Read the number of items in the queue
Sourcepub async fn peek_next(&self) -> Result<Option<T>, ErrorTypes>
pub async fn peek_next(&self) -> Result<Option<T>, ErrorTypes>
load the item that would be returned by the next call to pop
Sourcepub async fn content(&self) -> Result<Vec<T>, ErrorTypes>
pub async fn content(&self) -> Result<Vec<T>, ErrorTypes>
Load the entire content of the queue into memory
Sourcepub async fn delete(&self) -> Result<(), ErrorTypes>
pub async fn delete(&self) -> Result<(), ErrorTypes>
Clear all data for this object
Sourcepub async fn pop(&self) -> Result<Option<T>, ErrorTypes>
pub async fn pop(&self) -> Result<Option<T>, ErrorTypes>
dequeue an item from the front of the queue, returning immediately if empty
Sourcepub async fn pop_timeout(
&self,
timeout: Duration,
) -> Result<Option<T>, ErrorTypes>
pub async fn pop_timeout( &self, timeout: Duration, ) -> Result<Option<T>, ErrorTypes>
Make a blocking pop call with a timeout
Sourcepub async fn pop_batch(&self, limit: usize) -> Result<Vec<T>, ErrorTypes>
pub async fn pop_batch(&self, limit: usize) -> Result<Vec<T>, ErrorTypes>
Pop as many items as possible up to a certain limit
Auto Trait Implementations§
impl<T> Freeze for Queue<T>
impl<T> !RefUnwindSafe for Queue<T>
impl<T> Send for Queue<T>where
T: Send,
impl<T> Sync for Queue<T>where
T: Sync,
impl<T> Unpin for Queue<T>where
T: Unpin,
impl<T> !UnwindSafe for Queue<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