1mod balance;
4mod book_keeping;
5mod commodity;
6mod context;
7mod error;
8mod eval;
9mod price_db;
10pub mod query;
11mod transaction;
12
13use std::borrow::Borrow;
14
15pub use balance::Balance;
16pub use book_keeping::{process, ProcessOptions};
17pub use commodity::{Commodity, CommodityStore, CommodityTag, OwnedCommodity};
18pub use context::{Account, ReportContext};
19pub use error::ReportError;
20pub use eval::{Amount, SingleAmount};
21pub use price_db::LoadError;
22pub use transaction::{Posting, Transaction};
23
24use crate::{load, syntax::plain::LedgerEntry};
25
26pub fn accounts<'ctx, L, F>(
29 ctx: &'ctx mut context::ReportContext,
30 loader: L,
31) -> Result<Vec<Account<'ctx>>, load::LoadError>
32where
33 L: Borrow<load::Loader<F>>,
34 F: load::FileSystem,
35{
36 loader.borrow().load(|_path, _ctx, entry| {
37 if let LedgerEntry::Txn(txn) = entry {
38 for posting in &txn.posts {
39 ctx.accounts.ensure(&posting.account);
40 }
41 }
42 Ok::<(), load::LoadError>(())
43 })?;
44 Ok(ctx.all_accounts())
45}