Rust Lang Packages(Crates)
Some good crates to start with are:
- clap : for argument parsing
- serde : for file formats (eg JSON)
- errors - anyhow or thiserror 6 for easy error types
- tracing + tracing-subscriber : for logging/instrumentation.
- tokyo: async
shell & scripts: xshell or duct
Local dev
Auto rebuild on code change
cargo install cargo-watch cargo watch -x run
e.g. Cargo.toml
2023 web client
[dependencies] reqwest = "0.11.17" serde = { version = "1.0.163", features = ["derive"] } serde_json = "1.0.96" tokio = { version = "1.28.1", features = ["full"] }
std lib
- std::fs::File
- std::process:Command
- std::thread
logging
- crate log
crate logging_env
- crate env_logger
serde - Read json/yaml etc
- serde
- serde_path_to_error
pest - parser with dsl - https://lib.rs/crates/pest
Scripting with rust
- cargo install rust-script
Errors
- anyhow, snafu, eyre, thiserror,
e.g. anyhow
use anyhow::{Context, Result}; fn test -> Result<Str> { <<-- anyhow:Result only have to specify return type, not error ... }
error eg.
use thiserror::Error; #[non_exhaustive] #[derive(Error,Debug)] pub enum DolphinError { ... }
Paralel threads
- Tokyo
rayon for concurrent iter par_iter()
use rayon::prelude::*;
SQL / Database
- sqlx
- diesel
Web Sockets
bash shell commands
- xshell
# or
- duct
# or