02_current_weather_snapshot/
02_current_weather_snapshot.rs1#[path = "support/mod.rs"]
2mod support;
3
4use std::error::Error;
5
6use weatherkit::prelude::*;
7
8fn main() -> Result<(), Box<dyn Error>> {
9 let service = WeatherService::shared();
10 let location = support::sample_location();
11
12 if let Some(current) =
13 support::handle_result("current weather", service.current_weather(&location))?
14 {
15 println!(
16 "temp={:.1}°C feels_like={:.1}°C pressure={:.1}hPa daylight={}",
17 current.temperature,
18 current.feels_like,
19 current.pressure_reading().value,
20 current.is_daylight
21 );
22 }
23
24 support::finish("current weather");
25 Ok(())
26}