Skip to main content

Crate rustledger_loader

Crate rustledger_loader 

Source
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.
DiskFileSystem
Default filesystem that reads from disk.
EarlyValidated
Early validators ran; account-presence / lifecycle / structural errors collected.
ErrorLocation
Source location for an error.
ExtraPlugin
A CLI-supplied (or programmatic) extra plugin invocation.
Finalized
Failed transactions re-merged + re-sorted into the final display order.
LateValidated
Late-phase validators ran on booked + plugin-processed directives.
Ledger
A fully processed ledger.
LedgerError
Unified error type for ledger processing.
LoadOptions
Options for loading and processing a ledger.
LoadResult
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.
RegularPluginsApplied
Post-booking plugins applied to successfully-booked directives.
Sorted
Sorted by (date, priority, file_id, span.start) — canonical display order.
SourceFile
A source file in the source map.
SourceMap
A map of source files for error reporting.
Synthed
Synth-only plugins (auto_accounts, document_discovery) applied.
VirtualFileSystem
In-memory virtual filesystem for WASM and testing.

Enums§

ErrorSeverity
Error severity level.
LoadError
Errors that can occur during loading.
PluginPass
Which subset of plugins to run.
ProcessError
Errors that can occur during ledger processing.

Traits§

FileSystem
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 Spanned wrapper).
run_plugins
pass selects which subset of plugins to run — see PluginPass. The loader pipeline calls this twice (synth pass before Early, regular pass after booking).