Struct MarketPrice
pub struct MarketPrice { /* private fields */ }Expand description
A finite non-negative market price value.
Zero is accepted for descriptive use cases such as missing, halted, or placeholder prices.
Positive prices can be checked with MarketPrice::is_positive.
Implementations§
§impl MarketPrice
impl MarketPrice
pub fn new(value: f64) -> Result<MarketPrice, MarketPriceError>
pub fn new(value: f64) -> Result<MarketPrice, MarketPriceError>
Creates a market price from a finite non-negative f64.
§Errors
Returns [MarketPriceError::NonFinite] for NaN or infinite values and
[MarketPriceError::Negative] for negative values.
pub fn is_positive(self) -> bool
pub fn is_positive(self) -> bool
Returns whether the price is strictly positive.
Trait Implementations§
§impl Clone for MarketPrice
impl Clone for MarketPrice
§fn clone(&self) -> MarketPrice
fn clone(&self) -> MarketPrice
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 more§impl Debug for MarketPrice
impl Debug for MarketPrice
§impl Display for MarketPrice
impl Display for MarketPrice
§impl PartialEq for MarketPrice
impl PartialEq for MarketPrice
§impl PartialOrd for MarketPrice
impl PartialOrd for MarketPrice
§impl TryFrom<f64> for MarketPrice
impl TryFrom<f64> for MarketPrice
impl Copy for MarketPrice
impl StructuralPartialEq for MarketPrice
Auto Trait Implementations§
impl Freeze for MarketPrice
impl RefUnwindSafe for MarketPrice
impl Send for MarketPrice
impl Sync for MarketPrice
impl Unpin for MarketPrice
impl UnsafeUnpin for MarketPrice
impl UnwindSafe for MarketPrice
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