Skip to main content

HourlyWeatherStatistics

Struct HourlyWeatherStatistics 

Source
pub struct HourlyWeatherStatistics<T> {
    pub hours: Vec<T>,
    pub baseline_start_date: String,
    pub metadata: WeatherMetadata,
}

Fields§

§hours: Vec<T>§baseline_start_date: String§metadata: WeatherMetadata

Implementations§

Source§

impl<T> HourlyWeatherStatistics<T>

Source

pub fn len(&self) -> usize

Examples found in repository?
examples/14_weather_statistics_snapshot.rs (line 55)
15fn main() -> Result<(), Box<dyn Error>> {
16    let service = WeatherService::shared();
17    let location = support::sample_location();
18
19    if let Some(result) = support::handle_result(
20        "daily statistics",
21        service.daily_statistics(&location, DailyWeatherStatisticsQuery::Temperature),
22    )? {
23        match result {
24            DailyWeatherStatisticsResult::Temperature(stats) => {
25                println!("daily_temperature_stats={}", stats.len());
26            }
27            DailyWeatherStatisticsResult::Precipitation(stats) => {
28                println!("daily_precipitation_stats={}", stats.len());
29            }
30        }
31    }
32
33    if let Some(result) = support::handle_result(
34        "daily summary",
35        service.daily_summary_in(
36            &location,
37            sample_interval(7),
38            DailyWeatherSummaryQuery::Precipitation,
39        ),
40    )? {
41        match result {
42            DailyWeatherSummaryResult::Temperature(days) => {
43                println!("daily_temperature_summary={}", days.len());
44            }
45            DailyWeatherSummaryResult::Precipitation(days) => {
46                println!("daily_precipitation_summary={}", days.len());
47            }
48        }
49    }
50
51    if let Some(hourly) = support::handle_result(
52        "hourly statistics",
53        service.hourly_statistics(&location, HourlyWeatherStatisticsQuery::Temperature),
54    )? {
55        println!("hourly_temperature_stats={}", hourly.len());
56    }
57
58    if let Some(result) = support::handle_result(
59        "monthly statistics",
60        service.monthly_statistics_in(
61            &location,
62            sample_interval(120),
63            MonthlyWeatherStatisticsQuery::Precipitation,
64        ),
65    )? {
66        match result {
67            MonthlyWeatherStatisticsResult::Temperature(stats) => {
68                println!("monthly_temperature_stats={}", stats.len());
69            }
70            MonthlyWeatherStatisticsResult::Precipitation(stats) => {
71                println!("monthly_precipitation_stats={}", stats.len());
72            }
73        }
74    }
75
76    support::finish("weather statistics");
77    Ok(())
78}
Source

pub fn is_empty(&self) -> bool

Source

pub fn iter(&self) -> Iter<'_, T>

Trait Implementations§

Source§

impl<T: Clone> Clone for HourlyWeatherStatistics<T>

Source§

fn clone(&self) -> HourlyWeatherStatistics<T>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for HourlyWeatherStatistics<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de, T> Deserialize<'de> for HourlyWeatherStatistics<T>
where T: Deserialize<'de>,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<'a, T> IntoIterator for &'a HourlyWeatherStatistics<T>

Source§

type Item = &'a T

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, T>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<T: PartialEq> PartialEq for HourlyWeatherStatistics<T>

Source§

fn eq(&self, other: &HourlyWeatherStatistics<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T> StructuralPartialEq for HourlyWeatherStatistics<T>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,