pub struct MicroCents(pub u64);Expand description
Money in micro-cents (one cent = 1 000 000 micro-cents), integer so that cost comparisons are exact and hashable.
Tuple Fields§
§0: u64Implementations§
Source§impl MicroCents
impl MicroCents
Sourcepub const fn from_cents(cents: u64) -> Self
pub const fn from_cents(cents: u64) -> Self
Builds from whole cents (saturating).
Sourcepub const fn from_dollars(dollars: u64) -> Self
pub const fn from_dollars(dollars: u64) -> Self
Builds from whole dollars (saturating).
Sourcepub const fn saturating_add(self, other: Self) -> Self
pub const fn saturating_add(self, other: Self) -> Self
Saturating addition.
Trait Implementations§
Source§impl Clone for MicroCents
impl Clone for MicroCents
impl Copy for MicroCents
Source§impl Debug for MicroCents
impl Debug for MicroCents
Source§impl Default for MicroCents
impl Default for MicroCents
Source§impl<'de> Deserialize<'de> for MicroCents
impl<'de> Deserialize<'de> for MicroCents
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 Display for MicroCents
impl Display for MicroCents
impl Eq for MicroCents
Source§impl Hash for MicroCents
impl Hash for MicroCents
Source§impl Ord for MicroCents
impl Ord for MicroCents
1.21.0 (const: unstable) · 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
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialEq for MicroCents
impl PartialEq for MicroCents
Source§impl PartialOrd for MicroCents
impl PartialOrd for MicroCents
Source§impl Serialize for MicroCents
impl Serialize for MicroCents
impl StructuralPartialEq for MicroCents
Auto Trait Implementations§
impl Freeze for MicroCents
impl RefUnwindSafe for MicroCents
impl Send for MicroCents
impl Sync for MicroCents
impl Unpin for MicroCents
impl UnsafeUnpin for MicroCents
impl UnwindSafe for MicroCents
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.