#[non_exhaustive]pub struct ValidationOptions {
pub require_commodities: bool,
pub check_documents: bool,
pub warn_future_dates: bool,
pub document_base: Option<PathBuf>,
pub document_dirs: Vec<PathBuf>,
pub account_types: Vec<String>,
pub infer_tolerance_from_cost: bool,
pub tolerance_multiplier: Decimal,
pub inferred_tolerance_default: FxHashMap<String, Decimal>,
pub default_booking_method: BookingMethod,
}Expand description
Validation options.
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.require_commodities: boolWhether to require commodity declarations.
check_documents: boolWhether to check if document files exist.
warn_future_dates: boolWhether to warn about future-dated entries.
document_base: Option<PathBuf>Base directory for resolving relative document paths.
document_dirs: Vec<PathBuf>Document directories from option "documents".
Relative document paths are resolved against these directories.
Paths are resolved against the ledger file’s directory at load time.
account_types: Vec<String>Valid account type prefixes (from options like name_assets, name_liabilities, etc.).
Defaults to ["Assets", "Liabilities", "Equity", "Income", "Expenses"].
infer_tolerance_from_cost: boolWhether to infer tolerance from cost (matches Python beancount’s infer_tolerance_from_cost).
When true, tolerance for cost-based postings is calculated as: units_quantum * cost_per_unit.
tolerance_multiplier: DecimalTolerance multiplier (matches Python beancount’s inferred_tolerance_multiplier).
Default is 0.5.
inferred_tolerance_default: FxHashMap<String, Decimal>Per-currency default tolerances (matches Python beancount’s inferred_tolerance_default).
e.g., {"GBP": 0.004} means GBP transactions tolerate up to 0.004 residual.
default_booking_method: BookingMethodDefault booking method for accounts without an explicit method on
their open directive. Sourced from the file-level
option "booking_method" (or the API-level LoadOptions
default). Mirrors the resolved effective_method the booking
engine sees — without this, the validator’s per-account
lot-matching pass falls back to BookingMethod::default()
(i.e., STRICT) regardless of the file’s stated method,
re-raising the very NoMatchingLot/AmbiguousMatch errors
the booker just decided to skip under NONE (issue #1182).
Implementations§
Source§impl ValidationOptions
impl ValidationOptions
Sourcepub fn with_account_types(self, types: Vec<String>) -> Self
pub fn with_account_types(self, types: Vec<String>) -> Self
Set account types.
Sourcepub const fn with_require_commodities(self, require: bool) -> Self
pub const fn with_require_commodities(self, require: bool) -> Self
Set whether to require commodity declarations.
Sourcepub const fn with_check_documents(self, check: bool) -> Self
pub const fn with_check_documents(self, check: bool) -> Self
Set whether to check if document files exist.
Sourcepub const fn with_warn_future_dates(self, warn: bool) -> Self
pub const fn with_warn_future_dates(self, warn: bool) -> Self
Set whether to warn about future-dated entries.
Sourcepub fn with_document_dirs(self, dirs: Vec<PathBuf>) -> Self
pub fn with_document_dirs(self, dirs: Vec<PathBuf>) -> Self
Set document directories (resolved paths).
Sourcepub const fn with_infer_tolerance_from_cost(self, infer: bool) -> Self
pub const fn with_infer_tolerance_from_cost(self, infer: bool) -> Self
Set whether to infer tolerance from cost.
Sourcepub const fn with_tolerance_multiplier(self, multiplier: Decimal) -> Self
pub const fn with_tolerance_multiplier(self, multiplier: Decimal) -> Self
Set tolerance multiplier.
Sourcepub fn with_inferred_tolerance_default(
self,
defaults: FxHashMap<String, Decimal>,
) -> Self
pub fn with_inferred_tolerance_default( self, defaults: FxHashMap<String, Decimal>, ) -> Self
Set per-currency default tolerances.
Sourcepub const fn with_default_booking_method(self, method: BookingMethod) -> Self
pub const fn with_default_booking_method(self, method: BookingMethod) -> Self
Set the default booking method (file-level
option "booking_method"). Accounts without an explicit method
on their open directive inherit this rather than falling
through to BookingMethod::default().
Trait Implementations§
Source§impl Clone for ValidationOptions
impl Clone for ValidationOptions
Source§fn clone(&self) -> ValidationOptions
fn clone(&self) -> ValidationOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ValidationOptions
impl Debug for ValidationOptions
Auto Trait Implementations§
impl Freeze for ValidationOptions
impl RefUnwindSafe for ValidationOptions
impl Send for ValidationOptions
impl Sync for ValidationOptions
impl Unpin for ValidationOptions
impl UnsafeUnpin for ValidationOptions
impl UnwindSafe for ValidationOptions
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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,
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 moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.