pub struct DailyWeatherStatistics<T> {
pub days: Vec<T>,
pub baseline_start_date: String,
pub metadata: WeatherMetadata,
}Fields§
§days: Vec<T>§baseline_start_date: String§metadata: WeatherMetadataImplementations§
Source§impl<T> DailyWeatherStatistics<T>
impl<T> DailyWeatherStatistics<T>
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Examples found in repository?
examples/14_weather_statistics_snapshot.rs (line 25)
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}pub fn is_empty(&self) -> bool
pub fn iter(&self) -> Iter<'_, T>
Trait Implementations§
Source§impl<T: Clone> Clone for DailyWeatherStatistics<T>
impl<T: Clone> Clone for DailyWeatherStatistics<T>
Source§fn clone(&self) -> DailyWeatherStatistics<T>
fn clone(&self) -> DailyWeatherStatistics<T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: Debug> Debug for DailyWeatherStatistics<T>
impl<T: Debug> Debug for DailyWeatherStatistics<T>
Source§impl<'de, T> Deserialize<'de> for DailyWeatherStatistics<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for DailyWeatherStatistics<T>where
T: Deserialize<'de>,
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
Source§impl<'a, T> IntoIterator for &'a DailyWeatherStatistics<T>
impl<'a, T> IntoIterator for &'a DailyWeatherStatistics<T>
Source§impl<T: PartialEq> PartialEq for DailyWeatherStatistics<T>
impl<T: PartialEq> PartialEq for DailyWeatherStatistics<T>
Source§fn eq(&self, other: &DailyWeatherStatistics<T>) -> bool
fn eq(&self, other: &DailyWeatherStatistics<T>) -> bool
Tests for
self and other values to be equal, and is used by ==.impl<T> StructuralPartialEq for DailyWeatherStatistics<T>
Auto Trait Implementations§
impl<T> Freeze for DailyWeatherStatistics<T>
impl<T> RefUnwindSafe for DailyWeatherStatistics<T>where
T: RefUnwindSafe,
impl<T> Send for DailyWeatherStatistics<T>where
T: Send,
impl<T> Sync for DailyWeatherStatistics<T>where
T: Sync,
impl<T> Unpin for DailyWeatherStatistics<T>where
T: Unpin,
impl<T> UnsafeUnpin for DailyWeatherStatistics<T>
impl<T> UnwindSafe for DailyWeatherStatistics<T>where
T: UnwindSafe,
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