pub struct OrderQueue { /* private fields */ }Expand description
A thread-safe queue of orders with specialized operations
Implementations§
Source§impl OrderQueue
impl OrderQueue
Sourcepub fn find(&self, order_id: OrderId) -> Option<Arc<OrderType<()>>>
pub fn find(&self, order_id: OrderId) -> Option<Arc<OrderType<()>>>
Search for an order with the given ID. O(1) operation.
Sourcepub fn remove(&self, order_id: OrderId) -> Option<Arc<OrderType<()>>>
pub fn remove(&self, order_id: OrderId) -> Option<Arc<OrderType<()>>>
Remove an order with the given ID Returns the removed order if found. O(1) for the map, but the ID remains in the queue.
Sourcepub fn from_vec(orders: Vec<Arc<OrderType<()>>>) -> Self
pub fn from_vec(orders: Vec<Arc<OrderType<()>>>) -> Self
Creates a new OrderQueue instance and populates it with orders from the provided vector.
This function takes ownership of a vector of order references (wrapped in Arc) and constructs
a new OrderQueue by iteratively pushing each order into the queue. The resulting queue
maintains the insertion order of the original vector.
§Parameters
orders- A vector of atomic reference counted (Arc) order instances representing the orders to be added to the new queue.
§Returns
A new OrderQueue instance containing all the orders from the input vector.
Trait Implementations§
Source§impl Debug for OrderQueue
impl Debug for OrderQueue
Source§impl Default for OrderQueue
impl Default for OrderQueue
Source§impl<'de> Deserialize<'de> for OrderQueue
impl<'de> Deserialize<'de> for OrderQueue
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for OrderQueue
impl Display for OrderQueue
Source§impl From<OrderQueue> for Vec<Arc<OrderType<()>>>
impl From<OrderQueue> for Vec<Arc<OrderType<()>>>
Source§fn from(queue: OrderQueue) -> Self
fn from(queue: OrderQueue) -> Self
Converts to this type from the input type.
Source§impl FromStr for OrderQueue
impl FromStr for OrderQueue
Auto Trait Implementations§
impl !Freeze for OrderQueue
impl !RefUnwindSafe for OrderQueue
impl Send for OrderQueue
impl Sync for OrderQueue
impl Unpin for OrderQueue
impl UnwindSafe for OrderQueue
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