pub struct ClientOptions {
pub api_key: String,
pub language: String,
pub units: UnitSystem,
}Expand description
Options to configure the Client.
Fields§
§api_key: StringAn api key required to call the API.
language: StringSee https://openweathermap.org/current#multi for currently supported languages. This library will not attempt to validate the language passed in.
units: UnitSystemControls the units of certain metrics returned from the API.
Implementations§
Source§impl ClientOptions
impl ClientOptions
pub fn default_api_key() -> String
Sourcepub fn default_language() -> String
pub fn default_language() -> String
Defaults to “en”
Sourcepub fn default_units() -> UnitSystem
pub fn default_units() -> UnitSystem
Defaults to UnitSystem::Metric
Sourcepub fn masked_api_key(&self) -> String
pub fn masked_api_key(&self) -> String
Returns the API key with most of the characters masked out.
Sourcepub fn validate(&self) -> Result<(), InvalidOptionsError>
pub fn validate(&self) -> Result<(), InvalidOptionsError>
Sourcepub fn mask_api_key_if_present(&self, any_string: &str) -> String
pub fn mask_api_key_if_present(&self, any_string: &str) -> String
Take an arbitrary string that might have the self.api_key in it and returns a string with that all occurrences of the key masked.
Trait Implementations§
Source§impl Clone for ClientOptions
impl Clone for ClientOptions
Source§fn clone(&self) -> ClientOptions
fn clone(&self) -> ClientOptions
Returns a copy 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 ClientOptions
impl Debug for ClientOptions
Source§impl Default for ClientOptions
impl Default for ClientOptions
Source§impl<'de> Deserialize<'de> for ClientOptions
impl<'de> Deserialize<'de> for ClientOptions
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 ClientOptions
impl RefUnwindSafe for ClientOptions
impl Send for ClientOptions
impl Sync for ClientOptions
impl Unpin for ClientOptions
impl UnwindSafe for ClientOptions
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