好用的 crates

总会有新的可适用于开发命令行工具程序的 crates 被发布出来。

本书引用到的 crates

  • anyhow - provides anyhow::Error for easy error handling
  • assert_cmd - simplifies integration testing of CLIs
  • assert_fs - Setup input files and test output files
  • atty - detected whether application is running in a tty
  • clap-verbosity-flag - adds a --verbose flag to structopt CLIs
  • clap - command line argument parser
  • confy - boilerplate-free configuration management
  • crossbeam-channel - provides multi-producer multi-consumer channels for message passing
  • ctrlc - easy ctrl-c handler
  • env_logger - implements a logger configurable via environment variables
  • exitcode - system exit code constants
  • human-panic - panic message handler
  • indicatif - progress bars and spinners
  • log - provides logging abstracted over implementation
  • predicates - implements boolean-valued predicate functions
  • proptest - property testing framework
  • serde_json - serialize/deserialize to JSON
  • signal-hook - handles UNIX signals
  • structopt - parses command line arguments into a struct
  • tokio - asynchronous runtime
  • wasm-pack - tool for building WebAssembly

其它 crates

Rust 的 crates 景观是不断变化的,你可以在 lib.rs 查找 crates: 以下是一些可能对构建 CLIs 有用的特定的类别: