@@ -62,9 +62,9 @@ For an example with using Serde deserialization, please refer to [serde_integrat
6262
6363
6464``` rust
65+ use chrono :: {DateTime , Utc };
6566use influxdb :: {Client , Timestamp , ReadQuery };
6667use influxdb :: InfluxDbWriteable ;
67- use chrono :: {DateTime , Utc };
6868
6969#[tokio:: main]
7070// or #[async_std::main] if you prefer
@@ -76,22 +76,25 @@ async fn main() {
7676 struct WeatherReading {
7777 time : DateTime <Utc >,
7878 humidity : i32 ,
79- #[influxdb(tag)] wind_direction : String ,
79+ #[influxdb(tag)]
80+ wind_direction : String ,
8081 }
8182
8283 // Let's write some data into a measurement called `weather`
83- let weather_readings = vec! (
84+ let weather_readings = vec! [
8485 WeatherReading {
8586 time : Timestamp :: Hours (1 ). into (),
8687 humidity : 30 ,
8788 wind_direction : String :: from (" north" ),
88- }. into_query (" weather" ),
89+ }
90+ . into_query (" weather" ),
8991 WeatherReading {
9092 time : Timestamp :: Hours (2 ). into (),
9193 humidity : 40 ,
9294 wind_direction : String :: from (" west" ),
93- }. into_query (" weather" ),
94- );
95+ }
96+ . into_query (" weather" ),
97+ ];
9598
9699 if let Err (e ) = client . query (weather_readings ). await {
97100 println! (" Error writing result: {e}" );
0 commit comments