pub struct HistoricalRateResponse {
pub result: String,
pub base_code: String,
pub year: i32,
pub month: i32,
pub day: i32,
pub conversion_rates: HashMap<String, f64>,
}
Expand description
Response for historical exchange rates
Fields§
§result: String
Whether the request was successful
base_code: String
Base currency for the rates
year: i32
Date for these historical rates (YYYY-MM-DD)
month: i32
§day: i32
§conversion_rates: HashMap<String, f64>
Exchange rates for the specified date
Implementations§
Source§impl HistoricalRateResponse
impl HistoricalRateResponse
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Check if the API response indicates success
Sourcepub fn get_rate(&self, currency: &str) -> Option<f64>
pub fn get_rate(&self, currency: &str) -> Option<f64>
Get the exchange rate for a specific currency
Sourcepub fn get_date_string(&self) -> String
pub fn get_date_string(&self) -> String
Get the date as a formatted string
Sourcepub fn to_standard(&self) -> ExchangeRateResponse
pub fn to_standard(&self) -> ExchangeRateResponse
Convert to standard exchange rate response
Trait Implementations§
Source§impl Clone for HistoricalRateResponse
impl Clone for HistoricalRateResponse
Source§fn clone(&self) -> HistoricalRateResponse
fn clone(&self) -> HistoricalRateResponse
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for HistoricalRateResponse
impl Debug for HistoricalRateResponse
Source§impl<'de> Deserialize<'de> for HistoricalRateResponse
impl<'de> Deserialize<'de> for HistoricalRateResponse
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for HistoricalRateResponse
impl RefUnwindSafe for HistoricalRateResponse
impl Send for HistoricalRateResponse
impl Sync for HistoricalRateResponse
impl Unpin for HistoricalRateResponse
impl UnwindSafe for HistoricalRateResponse
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