Rust Toolkit

Useful cargo tools

Jacob Xie published on
1 min, 162 words

Categories: Doc

Tags: Rust

Rust

  • Installation:

    curl https://sh.rustup.rs -sSf | sh
    
  • [Optional] Toolchain and rustup mirrors: vim ~/.bashrc then source ~/.bashrc

    export RUSTUP_DIST_SERVER=https://mirrors.ustc.edu.cn/rust-static
    export RUSTUP_UPDATE_ROOT=https://mirrors.ustc.edu.cn/rust-static/rustup
    

    or

    export RUSTUP_DIST_SERVER=https://mirrors.tuna.tsinghua.edu.cn/rustup
    

    or

    RUSTUP_DIST_SERVER=https://mirrors.sjtug.sjtu.edu.cn/rust-static/
    
  • [Optional] Cargo mirrors: vim ~/.cargo/config

    [source.crates-io]
    replace-with = 'rsproxy'
    
    [source.rsproxy]
    registry = "https://rsproxy.cn/crates.io-index"
    
    [source.tuna]
    registry = "https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git"
    
    [source.ustc]
    registry = "git://mirrors.ustc.edu.cn/crates.io-index"
    
    [source.sjtu]
    registry = "https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index"
    

Cargo

Prerequisites for Ubuntu:

sudo apt install pkg-config
sudo apt install libssl-dev
sudo apt install build-essential
  • cargo-update: checking and applying updates to installed executables

    cargo install cargo-update
    
  • cargo-edit: allow add/remove/upgrade dependencies by modifying Cargo.toml

    cargo install cargo-edit
    
  • cargo-make: Rust task runner and build tool

    cargo install --force cargo-make