pub struct CurrencyTranslator { /* private fields */ }Expand description
Currency translator for financial statements.
Implementations§
Source§impl CurrencyTranslator
impl CurrencyTranslator
Sourcepub fn new(config: CurrencyTranslatorConfig) -> Self
pub fn new(config: CurrencyTranslatorConfig) -> Self
Creates a new currency translator.
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 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