#[non_exhaustive]pub struct Statement<const P: u8 = 2> {
pub account: AccountHandle,
pub path: AccountPath,
pub currency: Currency,
pub layer: Layer,
pub basis: DateBasis,
pub start: Option<Date>,
pub end: Option<Date>,
pub opening: Balance<P>,
pub lines: Vec<StatementLine<P>>,
pub closing: Balance<P>,
pub exponent: u8,
}Expand description
An account’s statement in one currency and layer over a window.
The lines are the selected postings dated within the window, ordered by
(basis date, position, posting index) — a backdated entry appears on its
date, not where it was recorded — and the opening balance holds the
selected postings dated before the window (zero for a window without a
start). A quiet window reads as unchanged: no lines and
closing == opening.
use doubleentry::prelude::*;
let mut books = Journal::new(LedgerId::new("example.com/acme")?);
books.declare_currency(EUR, 2, date!("2026-01-01"))?;
books.open("Assets:Bank", AccountKind::Asset, date!("2026-01-01"))?;
books.open("Income:Sales", AccountKind::Income, date!("2026-01-01"))?;
books.define_months(2026, 2..=3)?;
for (key, day, amount) in [("feb", date!("2026-02-10"), amount!("1000.00")), ("mar", date!("2026-03-05"), amount!("100.00"))] {
books.record(
Entry::new(key, day).debit("Assets:Bank", amount, EUR).credit("Income:Sales", amount, EUR),
)?;
}
let march = books.statement("Assets:Bank", EUR, &BalanceQuery::period("2026-03"))?;
assert_eq!(march.opening.net(), amount!("1000.00"));
assert_eq!(march.lines.len(), 1);
assert_eq!(march.closing.net(), amount!("1100.00"));
print!("{march}");Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.account: AccountHandleThe account.
path: AccountPathIts path.
currency: CurrencyThe currency.
layer: LayerThe layer.
basis: DateBasisThe date the window, the order and the opening read.
start: Option<Date>The window’s first day (None: from the beginning).
end: Option<Date>The window’s last day (None: to the head).
opening: Balance<P>The selected postings dated before the window.
lines: Vec<StatementLine<P>>The selected postings dated within the window, in date order.
closing: Balance<P>opening plus every line.
exponent: u8The currency’s declared exponent at the head read: the decimal places the report prints amounts with.
Trait Implementations§
Source§impl<'de, const P: u8> Deserialize<'de> for Statement<P>
Available on crate feature serde only.
impl<'de, const P: u8> Deserialize<'de> for Statement<P>
serde only.Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<const P: u8> Display for Statement<P>
impl<const P: u8> Display for Statement<P>
Source§fn fmt(&self, f: &mut Formatter<'_>) -> Result
fn fmt(&self, f: &mut Formatter<'_>) -> Result
A heading, the opening, one row per line and the closing, columns aligned (width is ignored), amounts at the currency’s exponent.
Assets:Bank EUR, settled, by booking date, 2026-03-01 to 2026-03-31
opening 1000.00
2026-03-05 5/0 debit 100.00 1100.00
closing 1100.00impl<const P: u8> Eq for Statement<P>
impl<const P: u8> StructuralPartialEq for Statement<P>
Auto Trait Implementations§
impl<const P: u8> Freeze for Statement<P>
impl<const P: u8> RefUnwindSafe for Statement<P>
impl<const P: u8> Send for Statement<P>
impl<const P: u8> Sync for Statement<P>
impl<const P: u8> Unpin for Statement<P>
impl<const P: u8> UnsafeUnpin for Statement<P>
impl<const P: u8> UnwindSafe for Statement<P>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more