@@ -62,9 +62,9 @@ For an example with using Serde deserialization, please refer to [serde_integrat
62
62
63
63
64
64
``` rust
65
+ use chrono :: {DateTime , Utc };
65
66
use influxdb :: {Client , Timestamp , ReadQuery };
66
67
use influxdb :: InfluxDbWriteable ;
67
- use chrono :: {DateTime , Utc };
68
68
69
69
#[tokio:: main]
70
70
// or #[async_std::main] if you prefer
@@ -76,22 +76,25 @@ async fn main() {
76
76
struct WeatherReading {
77
77
time : DateTime <Utc >,
78
78
humidity : i32 ,
79
- #[influxdb(tag)] wind_direction : String ,
79
+ #[influxdb(tag)]
80
+ wind_direction : String ,
80
81
}
81
82
82
83
// Let's write some data into a measurement called `weather`
83
- let weather_readings = vec! (
84
+ let weather_readings = vec! [
84
85
WeatherReading {
85
86
time : Timestamp :: Hours (1 ). into (),
86
87
humidity : 30 ,
87
88
wind_direction : String :: from (" north" ),
88
- }. into_query (" weather" ),
89
+ }
90
+ . into_query (" weather" ),
89
91
WeatherReading {
90
92
time : Timestamp :: Hours (2 ). into (),
91
93
humidity : 40 ,
92
94
wind_direction : String :: from (" west" ),
93
- }. into_query (" weather" ),
94
- );
95
+ }
96
+ . into_query (" weather" ),
97
+ ];
95
98
96
99
if let Err (e ) = client . query (weather_readings ). await {
97
100
println! (" Error writing result: {e}" );
0 commit comments