Struct darksky::Options
[−]
[src]
pub struct Options(_);
Build a list of options to send in the request, including the type of units that the API should return, the blocks to exclude, whether to extend the hourly forecast, and the language for the summary.
Refer to the documentation for get_forecast_with_options
on how to use
this.
Methods
impl Options
[src]
pub fn exclude(self, blocks: Vec<Block>) -> Self
[src]
Set the list of Datablock
s to exclude. For a full list of potential
datablocks to exclude, refer to Block
.
pub fn extend_hourly(self) -> Self
[src]
Extends the hourly forecast to the full 7
days ahead,
rather than only the first 2
days.
pub fn get_mut(&mut self) -> &mut HashMap<&'static str, String>
[src]
Gets a mutable reference to the underlying HashMap.
Examples
use darksky::Options; let mut options = Options::default().extend_hourly(); // Note: you probably shouldn't add keys yourself. If there is a key the // library does not support, please submit a PR. let mut inner = options.get_mut(); inner.insert("foo", "bar".to_owned()); assert_eq!(inner.len(), 2);
pub fn get_ref(&self) -> &HashMap<&'static str, String>
[src]
Gets an immuatble reference to the underlying HashMap.
Examples
use darksky::{Block, Options}; let options = Options::default().exclude(vec![Block::Hourly]); assert_eq!(options.get_ref().len(), 1);
pub fn into_inner(self) -> HashMap<&'static str, String>
[src]
Unwraps the struct, returning the underlying HashMap.
Examples
use darksky::{Block, Options}; let options = Options::default().exclude(vec![Block::Hourly]); let map = options.into_inner(); assert!(map.get("exclude").is_some());
pub fn language(self, language: Language) -> Self
[src]
Set the language of the summary
provided.
pub fn unit(self, unit: Unit) -> Self
[src]
Sets the unit type returned from the API. Refer to the
DarkSky documentation or the Unit
docs for more info.
Trait Implementations
impl Clone for Options
[src]
fn clone(&self) -> Options
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for Options
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more