Struct beancount_parser_2::Price
source · pub struct Price<S, D> {
pub currency: Currency<S>,
pub amount: Amount<S, D>,
}
Expand description
Price directive
Example
use beancount_parser_2::DirectiveContent;
let input = "2023-05-27 price CHF 4 PLN";
let beancount = beancount_parser_2::parse::<&str, f64>(input).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<S>
Currency
amount: Amount<S, D>
Price of the currency
Trait Implementations§
Auto Trait Implementations§
impl<S, D> RefUnwindSafe for Price<S, D>where D: RefUnwindSafe, S: RefUnwindSafe,
impl<S, D> Send for Price<S, D>where D: Send, S: Send,
impl<S, D> Sync for Price<S, D>where D: Sync, S: Sync,
impl<S, D> Unpin for Price<S, D>where D: Unpin, S: Unpin,
impl<S, D> UnwindSafe for Price<S, D>where D: UnwindSafe, S: 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