Rust

Installation

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Rustup

Concepts

  • target: x86_64-pc-windows-msvc, x86_64-unknown-linux-gnu, wasm32-unknown-unknown
  • toolchain: stable-x86_64-pc-windows-msvc, nightly-2021-05-11-x86_64-unknown-linux-gnu
  • component: rustc,rustsrc,rustfmt, rust-analyzer

Snippets

rustup update 

rustup toolchain install nightly

rustup target add wasm32-unknown-unknown --toolchain nightly

rustup default nightly

rustup override set nightly

Crates

Cargo

Plugins

  • cargo-outdated: Displaying when dependencies have newer versions available.
  • cargo-audit: Audit your dependencies for crates with security vulnerabilities.
  • cargo-udeps: Find unused dependencies in Cargo.toml
  • cargo-bloat: Find out what takes most of the space in your executable.
  • cargo-fuzz: Fuzzing with libFuzzer
  • cargo-insta: Snapshot testing
  • cargo-binstall: Binary installation for rust projects
  • cargo-geiger: Detects usage of unsafe Rust in a Rust crate and its dependencies.

Snippets

cargo add serde
cargo add serde -F derive
cargo add -D serde
cargo add -B serde

cargo tree
cargo tree -p libc
cargo tree -p libc -i

Cargo.toml

[profile.release]
lto = true
strip = true
opt-level = "z"

Resources