pub struct Level {
pub price: f64,
pub size: f64,
}Expand description
A single order-book price level: a resting quantity at a price.
Fields§
§price: f64Price of the level (strictly positive).
size: f64Resting size / quantity at this price (non-negative).
Implementations§
Source§impl Level
impl Level
Sourcepub fn new(price: f64, size: f64) -> Result<Self>
pub fn new(price: f64, size: f64) -> Result<Self>
Construct a level, validating that price is finite and strictly
positive and size is finite and non-negative.
§Errors
Returns Error::InvalidOrderBook if the price is not a finite
positive number, or the size is not a finite non-negative number.
Sourcepub const fn new_unchecked(price: f64, size: f64) -> Self
pub const fn new_unchecked(price: f64, size: f64) -> Self
Construct a level without validation. The caller asserts that price
is finite and positive and size is finite and non-negative.
Trait Implementations§
impl Copy for Level
impl StructuralPartialEq for Level
Auto Trait Implementations§
impl Freeze for Level
impl RefUnwindSafe for Level
impl Send for Level
impl Sync for Level
impl Unpin for Level
impl UnsafeUnpin for Level
impl UnwindSafe for Level
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,
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