pub struct CurrencyTranslator { /* private fields */ }Expand description
Currency translator for financial statements.
Implementations§
Source§impl CurrencyTranslator
impl CurrencyTranslator
Sourcepub fn new_with_framework(
config: CurrencyTranslatorConfig,
framework: &str,
) -> Self
pub fn new_with_framework( config: CurrencyTranslatorConfig, framework: &str, ) -> Self
Creates a new currency translator for a specific accounting framework.
Sourcepub fn new(config: CurrencyTranslatorConfig) -> Self
pub fn new(config: CurrencyTranslatorConfig) -> Self
Creates a new currency translator (defaults to US GAAP).
Sourcepub fn set_historical_equity_rates(&mut self, rates: HashMap<String, Decimal>)
pub fn set_historical_equity_rates(&mut self, rates: HashMap<String, Decimal>)
Sets historical equity rates for specific accounts.
These rates are used when translating equity accounts under the Temporal or MonetaryNonMonetary methods. The rates represent the exchange rate at the time equity transactions originally occurred.
Sourcepub fn translate_trial_balance(
&self,
trial_balance: &TrialBalance,
rate_table: &FxRateTable,
historical_rates: &HashMap<String, Decimal>,
) -> TranslatedTrialBalance
pub fn translate_trial_balance( &self, trial_balance: &TrialBalance, rate_table: &FxRateTable, historical_rates: &HashMap<String, Decimal>, ) -> TranslatedTrialBalance
Translates a trial balance from local to group currency.
Sourcepub fn translate_amount(
&self,
amount: Decimal,
local_currency: &str,
account_code: &str,
account_type: &TranslationAccountType,
rate_table: &FxRateTable,
date: NaiveDate,
) -> TranslatedAmount
pub fn translate_amount( &self, amount: Decimal, local_currency: &str, account_code: &str, account_type: &TranslationAccountType, rate_table: &FxRateTable, date: NaiveDate, ) -> TranslatedAmount
Translates a single amount.
For equity accounts, this method will use historical equity rates set
via set_historical_equity_rates if available, falling back to
Decimal::ONE when no historical rate is found.
Auto Trait Implementations§
impl Freeze for CurrencyTranslator
impl !RefUnwindSafe for CurrencyTranslator
impl Send for CurrencyTranslator
impl Sync for CurrencyTranslator
impl Unpin for CurrencyTranslator
impl UnsafeUnpin for CurrencyTranslator
impl !UnwindSafe for CurrencyTranslator
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.