January 2019
Intermediate to advanced
520 pages
14h 32m
English
Create a new binary crate and add all of the necessary dependencies to the Cargo.toml file of that crate:
[dependencies]clap = "2.32"failure = "0.1"r2d2 = "0.8"r2d2_redis = "0.8"redis = "0.9"
We added the dependencies that we used in the previous examples of this chapter—clap, failure, and r2d2. Also, we need the redis and r2d2_redis crates, which contain a connection manager for Redis so that we can use it with Pool from the r2d2 crate.
Next, let's import the types we need to create a tool:
use clap::{ crate_authors, crate_description, crate_name, crate_version, App, AppSettings, Arg, SubCommand,};use redis::{Commands, Connection, RedisError};use r2d2_redis::RedisConnectionManager;use std::collections::HashMap;
Note the usage ...
Read now
Unlock full access