pub struct CurrencyConverter {
pub exchange_service: ExchangeRateService,
}Expand description
Core currency conversion engine
Fields§
§exchange_service: ExchangeRateServiceImplementations§
Source§impl CurrencyConverter
impl CurrencyConverter
Sourcepub fn new(exchange_service: ExchangeRateService) -> Self
pub fn new(exchange_service: ExchangeRateService) -> Self
Create a new converter with an exchange rate service
Sourcepub async fn convert(
&self,
request: ConversionRequest,
) -> Result<ConversionResult>
pub async fn convert( &self, request: ConversionRequest, ) -> Result<ConversionResult>
Convert currency using the most efficient method available
Sourcepub async fn convert_batch(
&self,
requests: Vec<ConversionRequest>,
) -> Vec<Result<ConversionResult>> ⓘ
pub async fn convert_batch( &self, requests: Vec<ConversionRequest>, ) -> Vec<Result<ConversionResult>> ⓘ
Convert multiple currencies in parallel
Sourcepub async fn get_available_currencies(&self) -> Result<Vec<String>>
pub async fn get_available_currencies(&self) -> Result<Vec<String>>
Get available currencies from the exchange service
Sourcepub async fn is_currency_supported(&self, currency: &str) -> Result<bool>
pub async fn is_currency_supported(&self, currency: &str) -> Result<bool>
Check if a currency is supported
Trait Implementations§
Source§impl Clone for CurrencyConverter
impl Clone for CurrencyConverter
Source§fn clone(&self) -> CurrencyConverter
fn clone(&self) -> CurrencyConverter
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for CurrencyConverter
impl !UnwindSafe for CurrencyConverter
impl Freeze for CurrencyConverter
impl Send for CurrencyConverter
impl Sync for CurrencyConverter
impl Unpin for CurrencyConverter
impl UnsafeUnpin for CurrencyConverter
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