## page was renamed from Rust/Packages = Rust Lang Packages(Crates) = === Some good crates to start with are: === 1. clap : for argument parsing 1. serde : for file formats (eg JSON) 1. errors - anyhow or thiserror 6 for easy error types 1. tracing + tracing-subscriber : for logging/instrumentation. 1. tokyo: async 1. shell & scripts: xshell or [[https://github.com/oconnor663/duct.rs|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 * https://www.niccoloforlini.com/flawless-scripting-with-rust/# === Errors === * anyhow, snafu, eyre, thiserror, * e.g. anyhow {{{ use anyhow::{Context, Result}; fn test -> Result { <<-- 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 === * https://github.com/snapview/tokio-tungstenite === bash shell commands === * xshell # or * duct # or * https://docs.rs/tokio/1.32.0/tokio/process/struct.Command.html