pub struct HistoricalComparisons {
pub comparisons: Vec<HistoricalComparison>,
pub metadata: WeatherMetadata,
}Fields§
§comparisons: Vec<HistoricalComparison>§metadata: WeatherMetadataImplementations§
Source§impl HistoricalComparisons
impl HistoricalComparisons
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Examples found in repository?
examples/13_weather_changes_snapshot.rs (line 26)
8fn main() -> Result<(), Box<dyn Error>> {
9 let service = WeatherService::shared();
10 let location = support::sample_location();
11
12 if let Some(changes) = support::handle_result("weather changes", service.weather_changes(&location))? {
13 match changes {
14 Some(changes) => println!("changes={} metadata_date={}", changes.len(), changes.metadata.date),
15 None => println!("changes=none"),
16 }
17 }
18
19 if let Some(comparisons) = support::handle_result(
20 "historical comparisons",
21 service.historical_comparisons(&location),
22 )? {
23 match comparisons {
24 Some(comparisons) => println!(
25 "historical_comparisons={} metadata_date={}",
26 comparisons.len(), comparisons.metadata.date
27 ),
28 None => println!("historical_comparisons=none"),
29 }
30 }
31
32 support::finish("weather changes");
33 Ok(())
34}pub fn is_empty(&self) -> bool
pub fn iter(&self) -> Iter<'_, HistoricalComparison>
Trait Implementations§
Source§impl Clone for HistoricalComparisons
impl Clone for HistoricalComparisons
Source§fn clone(&self) -> HistoricalComparisons
fn clone(&self) -> HistoricalComparisons
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 Debug for HistoricalComparisons
impl Debug for HistoricalComparisons
Source§impl<'de> Deserialize<'de> for HistoricalComparisons
impl<'de> Deserialize<'de> for HistoricalComparisons
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> IntoIterator for &'a HistoricalComparisons
impl<'a> IntoIterator for &'a HistoricalComparisons
Source§impl PartialEq for HistoricalComparisons
impl PartialEq for HistoricalComparisons
Source§fn eq(&self, other: &HistoricalComparisons) -> bool
fn eq(&self, other: &HistoricalComparisons) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for HistoricalComparisons
Auto Trait Implementations§
impl Freeze for HistoricalComparisons
impl RefUnwindSafe for HistoricalComparisons
impl Send for HistoricalComparisons
impl Sync for HistoricalComparisons
impl Unpin for HistoricalComparisons
impl UnsafeUnpin for HistoricalComparisons
impl UnwindSafe for HistoricalComparisons
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