-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
We can do this all in just a few lines of Rust via the clap crate. However, for those familiar with the structopt crate, which allows one to define a Rust struct that contains all the CLI logic, as of clap 3.0 that code has been merged together. We will use the 3.0.0-beta.1 release of clap to demonstrate.
To let main() handle our errors, it needs to return a Result as well. Since we'll be dealing all kinds of different errors from different crates, it's helpful to have some convenience methods and representation for handling all this. The anyhow crate does just this!
The full code from this article can be found at github.com/kbknapp/grab-xkcd
We'll use cargo-edit to add our dependencies: