Skip to content

Commit 1ab1e4f

Browse files
authored
Bump to 0.11.0 for new options accessor (#29)
1 parent 4a1ec0f commit 1ab1e4f

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "beancount-parser-lima"
3-
version = "0.10.1"
3+
version = "0.11.0"
44
edition = "2021"
55
license = "MIT OR Apache-2.0"
66
description = "A zero-copy parser for Beancount"

src/options.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,7 @@ impl<'a> Options<'a> {
611611
&self.conversion_currency.item
612612
}
613613

614+
/// return the tolerance default for one particular currency
614615
pub fn inferred_tolerance_default(&self, currency: &Currency) -> Option<Decimal> {
615616
self.inferred_tolerance_default
616617
.get(&CurrencyOrAny::Currency(*currency))
@@ -621,6 +622,13 @@ impl<'a> Options<'a> {
621622
.map(|d| d.0))
622623
}
623624

625+
/// return the tolerance default fallback in case not defined for a particular currency
626+
pub fn inferred_tolerance_default_fallback(&self) -> Option<Decimal> {
627+
self.inferred_tolerance_default
628+
.get(&CurrencyOrAny::Any)
629+
.map(|d| d.0)
630+
}
631+
624632
/// return the tolerance defaults for all currencies, with None as the 'any' currency
625633
pub fn inferred_tolerance_defaults(&self) -> impl Iterator<Item = (Option<Currency>, Decimal)> {
626634
self.inferred_tolerance_default

0 commit comments

Comments
 (0)