Expand description
Beancount file loader with include resolution.
This crate handles loading beancount files, resolving includes, and collecting options. It builds on the parser to provide a complete loading pipeline.
§Features
- Recursive include resolution with cycle detection
- Options collection and parsing
- Plugin directive collection
- Source map for error reporting
- Push/pop tag and metadata handling
- Automatic GPG decryption for encrypted files (
.gpg,.asc)
§Example
ⓘ
use rustledger_loader::Loader;
use std::path::Path;
let result = Loader::new().load(Path::new("ledger.beancount"))?;
for directive in result.directives {
println!("{:?}", directive);
}Re-exports§
pub use cache::CACHE_FILENAME_ENV;pub use cache::CacheEntry;pub use cache::CachedOptions;pub use cache::CachedPlugin;pub use cache::DISABLE_CACHE_ENV;pub use cache::cache_disabled_by_env;pub use cache::cache_path;pub use cache::default_cache_path;pub use cache::invalidate_cache;pub use cache::load_cache_entry;pub use cache::save_cache_entry;
Modules§
- cache
- Binary cache for parsed ledgers.
Structs§
- Booked
- Cost-spec interpolation done; failed transactions partitioned out-of-band.
- Directives
- A directive collection at a specific pipeline phase.
- Disk
File System - Default filesystem that reads from disk.
- Early
Validated - Early validators ran; account-presence / lifecycle / structural errors collected.
- Error
Location - Source location for an error.
- Extra
Plugin - A CLI-supplied (or programmatic) extra plugin invocation.
- Finalized
- Failed transactions re-merged + re-sorted into the final display order.
- Late
Validated - Late-phase validators ran on booked + plugin-processed directives.
- Ledger
- A fully processed ledger.
- Ledger
Error - Unified error type for ledger processing.
- Load
Options - Options for loading and processing a ledger.
- Load
Result - Result of loading a beancount file.
- Loader
- Beancount file loader.
- Options
- Beancount file options.
- Plugin
- A plugin directive.
- Raw
- Straight from the parser — no ordering, synth, or booking guarantees.
- Regular
Plugins Applied - Post-booking plugins applied to successfully-booked directives.
- Sorted
- Sorted by
(date, priority, file_id, span.start)— canonical display order. - Source
File - A source file in the source map.
- Source
Map - A map of source files for error reporting.
- Synthed
- Synth-only plugins (
auto_accounts,document_discovery) applied. - Virtual
File System - In-memory virtual filesystem for WASM and testing.
Enums§
- Error
Severity - Error severity level.
- Load
Error - Errors that can occur during loading.
- Plugin
Pass - Which subset of plugins to run.
- Process
Error - Errors that can occur during ledger processing.
Traits§
- File
System - Abstract file system interface for file loading.
- Phase
- Marker trait for pipeline phases. Sealed: only the markers in this module implement it, so downstream crates can’t invent new phases (which would defeat the type-driven ordering).
Functions§
- load
- Load and fully process a beancount file.
- load_
raw - Load a beancount file without processing.
- process
- Process a raw load result into a fully processed ledger.
- reintern_
directives - Re-intern all strings in directives to deduplicate memory.
- reintern_
plain_ directives - Re-intern strings in a slice of plain directives (without
Spannedwrapper). - run_
plugins passselects which subset of plugins to run — seePluginPass. The loader pipeline calls this twice (synth pass before Early, regular pass after booking).