pub struct SingleAmount<'ctx> { /* private fields */ }
Expand description
Amount with only one commodity.
Implementations§
Source§impl<'ctx> SingleAmount<'ctx>
impl<'ctx> SingleAmount<'ctx>
Sourcepub fn from_value(value: Decimal, commodity: Commodity<'ctx>) -> Self
pub fn from_value(value: Decimal, commodity: Commodity<'ctx>) -> Self
Constructs an instance with single commodity.
Sourcepub fn check_add(self, rhs: Self) -> Result<Self, EvalError>
pub fn check_add(self, rhs: Self) -> Result<Self, EvalError>
Adds the amount with keeping commodity single.
Sourcepub fn check_sub(self, rhs: Self) -> Result<Self, EvalError>
pub fn check_sub(self, rhs: Self) -> Result<Self, EvalError>
Subtracts the amount with keeping the commodity single.
Sourcepub fn round(self, ctx: &ReportContext<'_>) -> Self
pub fn round(self, ctx: &ReportContext<'_>) -> Self
Rounds the Amount with the given context provided precision.
Trait Implementations§
Source§impl<'ctx> Add<SingleAmount<'ctx>> for Amount<'ctx>
impl<'ctx> Add<SingleAmount<'ctx>> for Amount<'ctx>
Source§impl<'ctx> AddAssign<SingleAmount<'ctx>> for Amount<'ctx>
impl<'ctx> AddAssign<SingleAmount<'ctx>> for Amount<'ctx>
Source§fn add_assign(&mut self, rhs: SingleAmount<'ctx>)
fn add_assign(&mut self, rhs: SingleAmount<'ctx>)
Performs the
+=
operation. Read moreSource§impl<'ctx> Clone for SingleAmount<'ctx>
impl<'ctx> Clone for SingleAmount<'ctx>
Source§fn clone(&self) -> SingleAmount<'ctx>
fn clone(&self) -> SingleAmount<'ctx>
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<'ctx> Debug for SingleAmount<'ctx>
impl<'ctx> Debug for SingleAmount<'ctx>
Source§impl Display for SingleAmount<'_>
impl Display for SingleAmount<'_>
Source§impl<'ctx> From<SingleAmount<'ctx>> for Amount<'ctx>
impl<'ctx> From<SingleAmount<'ctx>> for Amount<'ctx>
Source§fn from(value: SingleAmount<'ctx>) -> Self
fn from(value: SingleAmount<'ctx>) -> Self
Converts to this type from the input type.
Source§impl Mul<Decimal> for SingleAmount<'_>
impl Mul<Decimal> for SingleAmount<'_>
Source§impl Neg for SingleAmount<'_>
impl Neg for SingleAmount<'_>
Source§impl<'ctx> PartialEq for SingleAmount<'ctx>
impl<'ctx> PartialEq for SingleAmount<'ctx>
Source§impl<'ctx> TryFrom<&Amount<'ctx>> for SingleAmount<'ctx>
impl<'ctx> TryFrom<&Amount<'ctx>> for SingleAmount<'ctx>
Source§impl<'ctx> TryFrom<Amount<'ctx>> for SingleAmount<'ctx>
impl<'ctx> TryFrom<Amount<'ctx>> for SingleAmount<'ctx>
impl<'ctx> Copy for SingleAmount<'ctx>
impl<'ctx> Eq for SingleAmount<'ctx>
impl<'ctx> StructuralPartialEq for SingleAmount<'ctx>
Auto Trait Implementations§
impl<'ctx> Freeze for SingleAmount<'ctx>
impl<'ctx> RefUnwindSafe for SingleAmount<'ctx>
impl<'ctx> Send for SingleAmount<'ctx>
impl<'ctx> Sync for SingleAmount<'ctx>
impl<'ctx> Unpin for SingleAmount<'ctx>
impl<'ctx> UnwindSafe for SingleAmount<'ctx>
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