Skip to main content

Options

Struct Options 

Source
pub struct Options {
Show 30 fields pub title: Option<String>, pub filename: Option<String>, pub operating_currency: Vec<String>, pub name_assets: String, pub name_liabilities: String, pub name_equity: String, pub name_income: String, pub name_expenses: String, pub account_rounding: Option<String>, pub account_previous_balances: String, pub account_previous_earnings: String, pub account_previous_conversions: String, pub account_current_earnings: String, pub account_current_conversions: Option<String>, pub account_unrealized_gains: Option<String>, pub conversion_currency: Option<String>, pub inferred_tolerance_default: HashMap<String, Decimal>, pub inferred_tolerance_multiplier: Decimal, pub infer_tolerance_from_cost: bool, pub use_legacy_fixed_tolerances: bool, pub experiment_explicit_tolerances: bool, pub booking_method: String, pub render_commas: bool, pub display_precision: HashMap<String, u32>, pub allow_pipe_separator: bool, pub long_string_maxlines: u32, pub documents: Vec<String>, pub plugin_processing_mode: String, pub custom: HashMap<String, String>, pub warnings: Vec<OptionWarning>, /* private fields */
}
Expand description

Beancount file options.

These correspond to the option directives in beancount files.

Fields§

§title: Option<String>

Title for the ledger.

§filename: Option<String>

Source filename (auto-set).

§operating_currency: Vec<String>

Operating currencies (for reporting).

§name_assets: String

Name prefix for Assets accounts.

§name_liabilities: String

Name prefix for Liabilities accounts.

§name_equity: String

Name prefix for Equity accounts.

§name_income: String

Name prefix for Income accounts.

§name_expenses: String

Name prefix for Expenses accounts.

§account_rounding: Option<String>

Account for rounding errors.

§account_previous_balances: String

Account for previous balances (opening balances).

§account_previous_earnings: String

Account for previous earnings.

§account_previous_conversions: String

Account for previous conversions.

§account_current_earnings: String

Account for current earnings.

§account_current_conversions: Option<String>

Account for current conversion differences.

§account_unrealized_gains: Option<String>

Account for unrealized gains.

§conversion_currency: Option<String>

Currency for conversion (if specified).

§inferred_tolerance_default: HashMap<String, Decimal>

Default tolerances per currency (e.g., “USD:0.005” or “*:0.001”).

§inferred_tolerance_multiplier: Decimal

Tolerance multiplier for balance assertions.

§infer_tolerance_from_cost: bool

Whether to infer tolerance from cost.

§use_legacy_fixed_tolerances: bool

Whether to use legacy fixed tolerances.

§experiment_explicit_tolerances: bool

Enable experimental explicit tolerances in balance assertions.

§booking_method: String

Default booking method.

§render_commas: bool

Whether to render commas in numbers.

§display_precision: HashMap<String, u32>

Display precision per currency (e.g., “USD:2” means format USD with 2 decimal places). Format: CURRENCY:PRECISION where PRECISION is the number of decimal places.

§allow_pipe_separator: bool

Whether to allow pipe separator in numbers.

§long_string_maxlines: u32

Maximum lines in multi-line strings.

§documents: Vec<String>

Directories to scan for document files.

§plugin_processing_mode: String

Plugin processing mode: “default” or “raw”.

§custom: HashMap<String, String>

Any other custom options.

§warnings: Vec<OptionWarning>

Validation warnings collected during parsing.

Implementations§

Source§

impl Options

Source

pub fn new() -> Self

Create new options with defaults.

Source

pub fn set(&mut self, key: &str, value: &str)

Set an option by name.

Validates the option and collects any warnings in self.warnings.

Source

pub fn get(&self, key: &str) -> Option<&str>

Get a custom option value.

Source

pub fn account_types(&self) -> [&str; 5]

Get all account type prefixes.

Trait Implementations§

Source§

impl Clone for Options

Source§

fn clone(&self) -> Options

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Options

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Options

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl From<&Options> for CachedOptions

Source§

fn from(opts: &Options) -> Self

Converts to this type from the input type.
Source§

impl From<CachedOptions> for Options

Source§

fn from(cached: CachedOptions) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<'src, T> IntoMaybe<'src, T> for T
where T: 'src,

Source§

type Proj<U: 'src> = U

Source§

fn map_maybe<R>( self, _f: impl FnOnce(&'src T) -> &'src R, g: impl FnOnce(T) -> R, ) -> <T as IntoMaybe<'src, T>>::Proj<R>
where R: 'src,

Source§

impl<T> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
Source§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

Source§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
Source§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The metadata type for pointers and references to this type.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<'p, T> Seq<'p, T> for T
where T: Clone,

Source§

type Item<'a> = &'a T where T: 'a

The item yielded by the iterator.
Source§

type Iter<'a> = Once<&'a T> where T: 'a

An iterator over the items within this container, by reference.
Source§

fn seq_iter(&self) -> <T as Seq<'p, T>>::Iter<'_>

Iterate over the elements of the container.
Source§

fn contains(&self, val: &T) -> bool
where T: PartialEq,

Check whether an item is contained within this sequence.
Source§

fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>
where 'p: 'b,

Convert an item of the sequence into a MaybeRef.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> OrderedSeq<'_, T> for T
where T: Clone,