Struct ledger_rs_lib::amount::Amount
source · pub struct Amount {
pub quantity: Decimal,
pub commodity_index: Option<NodeIndex>,
}Fields§
§quantity: Decimal§commodity_index: Option<NodeIndex>Implementations§
source§impl Amount
impl Amount
pub fn new(quantity: Decimal, commodity_index: Option<NodeIndex>) -> Self
sourcepub fn parse(amount: &str, commodity_index: Option<NodeIndex>) -> Option<Self>
pub fn parse(amount: &str, commodity_index: Option<NodeIndex>) -> Option<Self>
Creates a new Amount instance. Parses the quantity only and uses the given commodity index.
pub fn copy_from(other: &Amount) -> Self
pub fn null() -> Self
pub fn add(&mut self, other: &Amount)
sourcepub fn is_null(&self) -> bool
pub fn is_null(&self) -> bool
Indicates whether the amount is initialized. This is a 0 quantity and no Commodity.
pub fn is_zero(&self) -> bool
Trait Implementations§
source§impl AddAssign<Amount> for Amount
impl AddAssign<Amount> for Amount
source§fn add_assign(&mut self, other: Amount)
fn add_assign(&mut self, other: Amount)
Performs the
+= operation. Read moresource§impl PartialEq<Amount> for Amount
impl PartialEq<Amount> for Amount
source§impl SubAssign<Amount> for Amount
impl SubAssign<Amount> for Amount
source§fn sub_assign(&mut self, other: Amount)
fn sub_assign(&mut self, other: Amount)
Performs the
-= operation. Read moreimpl Copy for Amount
impl StructuralPartialEq for Amount
Auto Trait Implementations§
impl RefUnwindSafe for Amount
impl Send for Amount
impl Sync for Amount
impl Unpin 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