pub struct Amount { /* private fields */ }Expand description
A validated amount: its wire string and the same value as a Dec.
Implementations§
Source§impl Amount
impl Amount
Sourcepub fn parse(text: &str) -> Result<Amount, BadAmount>
pub fn parse(text: &str) -> Result<Amount, BadAmount>
What a person typed, checked by clean_amount.
Sourcepub fn cut(value: Dec, places: u32) -> Result<Amount, BadAmount>
pub fn cut(value: Dec, places: u32) -> Result<Amount, BadAmount>
A computed figure cut toward zero to places (at most eight), so it never asks for more
than is there.
pub const fn value(&self) -> Dec
Trait Implementations§
impl Eq for Amount
impl StructuralPartialEq for Amount
Auto Trait Implementations§
impl Freeze for Amount
impl RefUnwindSafe for Amount
impl Send for Amount
impl Sync for Amount
impl Unpin for Amount
impl UnsafeUnpin for Amount
impl UnwindSafe for Amount
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> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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.