pub struct SharedOrderBookSnapshot<const N: usize = 64> { /* private fields */ }Expand description
Thread-safe wrapper around OrderBookSnapshot with low-contention read/write access
Implementations§
Sourcepub fn new(book: OrderBookSnapshot<N>) -> Self
pub fn new(book: OrderBookSnapshot<N>) -> Self
Create a new shared order book depth
Sourcepub fn update(&self, book: OrderBookSnapshot<N>)
pub fn update(&self, book: OrderBookSnapshot<N>)
Update the order book with a new snapshot
Sourcepub fn read<F, R>(&self, f: F) -> Rwhere
F: FnOnce(&OrderBookSnapshot<N>) -> R,
pub fn read<F, R>(&self, f: F) -> Rwhere
F: FnOnce(&OrderBookSnapshot<N>) -> R,
Execute a read operation on the order book
Sourcepub fn write<F, R>(&self, f: F) -> Rwhere
F: FnOnce(&mut OrderBookSnapshot<N>) -> R,
pub fn write<F, R>(&self, f: F) -> Rwhere
F: FnOnce(&mut OrderBookSnapshot<N>) -> R,
Execute a write operation on the order book
Trait Implementations§
Source§fn clone(&self) -> SharedOrderBookSnapshot<N>
fn clone(&self) -> SharedOrderBookSnapshot<N>
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
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