pub struct Price(/* private fields */);Expand description
Domain value type representing a price.
Implementations§
Source§impl Price
impl Price
Sourcepub fn try_new(value: u128) -> Result<Self, PriceLevelError>
pub fn try_new(value: u128) -> Result<Self, PriceLevelError>
Creates a validated price from a raw integer value.
Sourcepub fn from_f64(value: f64) -> Result<Self, PriceLevelError>
pub fn from_f64(value: f64) -> Result<Self, PriceLevelError>
Creates a price from an f64 value.
Sourcepub fn to_f64_lossy(self) -> f64
pub fn to_f64_lossy(self) -> f64
Converts the price to f64 with potential precision loss.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Price
impl<'de> Deserialize<'de> for Price
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 Ord for Price
impl Ord for Price
Source§impl PartialOrd for Price
impl PartialOrd for Price
impl Copy for Price
impl Eq for Price
impl StructuralPartialEq for Price
Auto Trait Implementations§
impl Freeze for Price
impl RefUnwindSafe for Price
impl Send for Price
impl Sync for Price
impl Unpin for Price
impl UnsafeUnpin for Price
impl UnwindSafe for Price
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