pub struct Config {
pub base_url: String,
pub api_key: Option<String>,
pub timeout: Duration,
pub user_agent: String,
pub max_retries: u32,
}Expand description
Configuration for the currency converter client
Fields§
§base_url: StringBase URL for the API
api_key: Option<String>API key (optional for some services)
timeout: DurationRequest timeout duration
user_agent: StringUser agent string for requests
max_retries: u32Maximum number of retries for failed requests
Implementations§
Source§impl Config
impl Config
Sourcepub fn with_api_key<S: Into<String>>(self, api_key: S) -> Self
pub fn with_api_key<S: Into<String>>(self, api_key: S) -> Self
Set the API key from environment variable or explicit value
Sourcepub fn with_base_url<S: Into<String>>(self, base_url: S) -> Self
pub fn with_base_url<S: Into<String>>(self, base_url: S) -> Self
Set the base URL
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Set the request timeout
Sourcepub fn get_api_key(&self) -> Result<&str>
pub fn get_api_key(&self) -> Result<&str>
Get the API key, returning an error if not set
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
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