pub struct FixedDecimal<const WIDTH: u8, const SCALE: u8>(pub Decimal);Expand description
Decimal wrapper enforcing compile-time width/scale.
Tuple Fields§
§0: DecimalTrait Implementations§
Source§impl<const W: u8, const S: u8> AsValue for FixedDecimal<W, S>
impl<const W: u8, const S: u8> AsValue for FixedDecimal<W, S>
Source§fn as_empty_value() -> Value
fn as_empty_value() -> Value
Return an “empty” (NULL-like) value variant for this type. Used when
constructing composite
Value containers (arrays, maps) or representing
absent optional data. This should never allocate and should not rely on
default trait implementations of Self.Source§fn as_value(self) -> Value
fn as_value(self) -> Value
Convert this value into its owned
Value representation. This should
perform any necessary wrapping (e.g. collections into List, decimals
into Decimal) but avoid lossy transformations unless explicitly
documented.Source§fn try_from_value(value: Value) -> Result<FixedDecimal<W, S>, Error>where
FixedDecimal<W, S>: Sized,
fn try_from_value(value: Value) -> Result<FixedDecimal<W, S>, Error>where
FixedDecimal<W, S>: Sized,
Source§impl<const WIDTH: u8, const SCALE: u8> Clone for FixedDecimal<WIDTH, SCALE>
impl<const WIDTH: u8, const SCALE: u8> Clone for FixedDecimal<WIDTH, SCALE>
Source§fn clone(&self) -> FixedDecimal<WIDTH, SCALE>
fn clone(&self) -> FixedDecimal<WIDTH, SCALE>
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 moreSource§impl<const WIDTH: u8, const SCALE: u8> Default for FixedDecimal<WIDTH, SCALE>
impl<const WIDTH: u8, const SCALE: u8> Default for FixedDecimal<WIDTH, SCALE>
Source§fn default() -> FixedDecimal<WIDTH, SCALE>
fn default() -> FixedDecimal<WIDTH, SCALE>
Returns the “default value” for a type. Read more
Source§impl<const W: u8, const S: u8> From<Decimal> for FixedDecimal<W, S>
impl<const W: u8, const S: u8> From<Decimal> for FixedDecimal<W, S>
Source§fn from(value: Decimal) -> FixedDecimal<W, S>
fn from(value: Decimal) -> FixedDecimal<W, S>
Converts to this type from the input type.
Source§impl<const WIDTH: u8, const SCALE: u8> Ord for FixedDecimal<WIDTH, SCALE>
impl<const WIDTH: u8, const SCALE: u8> Ord for FixedDecimal<WIDTH, SCALE>
Source§fn cmp(&self, other: &FixedDecimal<WIDTH, SCALE>) -> Ordering
fn cmp(&self, other: &FixedDecimal<WIDTH, SCALE>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<const WIDTH: u8, const SCALE: u8> PartialOrd for FixedDecimal<WIDTH, SCALE>
impl<const WIDTH: u8, const SCALE: u8> PartialOrd for FixedDecimal<WIDTH, SCALE>
impl<const WIDTH: u8, const SCALE: u8> Copy for FixedDecimal<WIDTH, SCALE>
impl<const WIDTH: u8, const SCALE: u8> Eq for FixedDecimal<WIDTH, SCALE>
impl<const WIDTH: u8, const SCALE: u8> StructuralPartialEq for FixedDecimal<WIDTH, SCALE>
Auto Trait Implementations§
impl<const WIDTH: u8, const SCALE: u8> Freeze for FixedDecimal<WIDTH, SCALE>
impl<const WIDTH: u8, const SCALE: u8> RefUnwindSafe for FixedDecimal<WIDTH, SCALE>
impl<const WIDTH: u8, const SCALE: u8> Send for FixedDecimal<WIDTH, SCALE>
impl<const WIDTH: u8, const SCALE: u8> Sync for FixedDecimal<WIDTH, SCALE>
impl<const WIDTH: u8, const SCALE: u8> Unpin for FixedDecimal<WIDTH, SCALE>
impl<const WIDTH: u8, const SCALE: u8> UnwindSafe for FixedDecimal<WIDTH, SCALE>
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