#[non_exhaustive]pub struct Balance<D> {
pub account: Account,
pub amount: Amount<D>,
pub tolerance: Option<D>,
}
Expand description
Balance assertion
§Example
use beancount_parser::{BeancountFile, DirectiveContent};
let input = "2022-05-24 balance Assets:Bank:Checking 10 CHF";
let beancount: BeancountFile<f64> = input.parse().unwrap();
let DirectiveContent::Balance(balance) = &beancount.directives[0].content else { unreachable!() };
assert_eq!(balance.account.as_str(), "Assets:Bank:Checking");
assert_eq!(balance.amount.value, 10.0);
assert_eq!(balance.amount.currency.as_str(), "CHF");
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.account: Account
Account being asserted
amount: Amount<D>
Amount the amount should have on the date
tolerance: Option<D>
Explicit precision tolerance
See: https://beancount.github.io/docs/precision_tolerances.html#explicit-tolerances-on-balance-assertions
Trait Implementations§
impl<D> StructuralPartialEq for Balance<D>
Auto Trait Implementations§
impl<D> Freeze for Balance<D>where
D: Freeze,
impl<D> RefUnwindSafe for Balance<D>where
D: RefUnwindSafe,
impl<D> Send for Balance<D>where
D: Send,
impl<D> Sync for Balance<D>where
D: Sync,
impl<D> Unpin for Balance<D>where
D: Unpin,
impl<D> UnwindSafe for Balance<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