ExchangeRateFn

Trait ExchangeRateFn 

Source
pub trait ExchangeRateFn {
    // Required method
    fn relative_to_base_currency(
        &self,
        currency: &str,
    ) -> Result<f64, Box<dyn Error + Send + Sync + 'static>>;
}
👎Deprecated: Use ExchangeRateFnV2 instead
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>>

👎Deprecated: Use ExchangeRateFnV2::relative_to_base_currency instead

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>>,