pub struct MemoryTicketQueue(Arc<RwLock<BinaryHeap<Reverse<RedeemableTicket>>>>);Expand description
Simple in-memory ticket queue implementation using a binary heap.
This is suitable for testing where ticket persistence is not required.
The implementation might not be particularly efficient for production use.
Tuple Fields§
§0: Arc<RwLock<BinaryHeap<Reverse<RedeemableTicket>>>>Trait Implementations§
Source§impl Clone for MemoryTicketQueue
impl Clone for MemoryTicketQueue
Source§fn clone(&self) -> MemoryTicketQueue
fn clone(&self) -> MemoryTicketQueue
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MemoryTicketQueue
impl Debug for MemoryTicketQueue
Source§impl Default for MemoryTicketQueue
impl Default for MemoryTicketQueue
Source§fn default() -> MemoryTicketQueue
fn default() -> MemoryTicketQueue
Returns the “default value” for a type. Read more
Source§impl TicketQueue for MemoryTicketQueue
impl TicketQueue for MemoryTicketQueue
type Error = Infallible
Source§fn push(&mut self, ticket: RedeemableTicket) -> Result<(), Self::Error>
fn push(&mut self, ticket: RedeemableTicket) -> Result<(), Self::Error>
Add a ticket to the queue.
Source§fn pop(&mut self) -> Result<Option<RedeemableTicket>, Self::Error>
fn pop(&mut self) -> Result<Option<RedeemableTicket>, Self::Error>
Remove and return the next ticket in-order from the queue. Read more
Source§fn peek(&self) -> Result<Option<RedeemableTicket>, Self::Error>
fn peek(&self) -> Result<Option<RedeemableTicket>, Self::Error>
Return the next ticket in-order from the queue without removing it. Read more
Source§fn iter_unordered(
&self,
) -> Result<impl Iterator<Item = Result<RedeemableTicket, Self::Error>>, Self::Error>
fn iter_unordered( &self, ) -> Result<impl Iterator<Item = Result<RedeemableTicket, Self::Error>>, Self::Error>
Iterate over all tickets in the queue in arbitrary order. Read more
Auto Trait Implementations§
impl Freeze for MemoryTicketQueue
impl !RefUnwindSafe for MemoryTicketQueue
impl Send for MemoryTicketQueue
impl Sync for MemoryTicketQueue
impl Unpin for MemoryTicketQueue
impl !UnwindSafe for MemoryTicketQueue
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more