pub struct Price<D> {
pub currency: Currency,
pub amount: Amount<D>,
}
Expand description
Price directive
§Example
use beancount_parser::{BeancountFile, DirectiveContent};
let input = "2023-05-27 price CHF 4 PLN";
let beancount: BeancountFile<f64> = input.parse().unwrap();
let DirectiveContent::Price(price) = &beancount.directives[0].content else { unreachable!() };
assert_eq!(price.currency.as_str(), "CHF");
assert_eq!(price.amount.value, 4.0);
assert_eq!(price.amount.currency.as_str(), "PLN");
Fields§
§currency: Currency
Currency
amount: Amount<D>
Price of the currency
Trait Implementations§
impl<D> StructuralPartialEq for Price<D>
Auto Trait Implementations§
impl<D> Freeze for Price<D>where
D: Freeze,
impl<D> RefUnwindSafe for Price<D>where
D: RefUnwindSafe,
impl<D> Send for Price<D>where
D: Send,
impl<D> Sync for Price<D>where
D: Sync,
impl<D> Unpin for Price<D>where
D: Unpin,
impl<D> UnwindSafe for Price<D>where
D: UnwindSafe,
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