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; the core does not depend on your decision at all, as long as its 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 Twhere T: Fn(&str) -> Result<f64, Box<dyn Error + Send + Sync + 'static>>,