Trait fend_core::ExchangeRateFn

source ·
pub trait ExchangeRateFn {
    // Required method
    fn relative_to_base_currency(
        &self,
        currency: &str
    ) -> Result<f64, Box<dyn Error + Send + Sync + 'static>>;
}
Expand description

An exchange rate handler.

Required Methods§

source

fn relative_to_base_currency( &self, currency: &str ) -> Result<f64, Box<dyn Error + Send + Sync + 'static>>

Returns the value of a currency relative to the base currency. The base currency depends on your implementation. fend-core can work with any base currency as long as it is consistent.

§Errors

This function errors out if the currency was not found or the conversion is impossible for any reason (HTTP request failed, etc.)

Implementors§

source§

impl<T> ExchangeRateFn for T
where T: Fn(&str) -> Result<f64, Box<dyn Error + Send + Sync + 'static>>,