Skip to main content

Rust

Install Rust​

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

Install Rust Nightly build​

rustup install nightly

Debug Rust source code in VS Code​

  1. Install VS Code Plugin C/C++ for Windows / CodeLLDB for (OS X / Linux) for native code debugging.
  2. Add "debug.allowBreakpointsEverywhere": true in .vscode -> settings.json file

Other VSCode Tools for Rust​

  1. Racer - code completion for Rust

Build​

Build the rust application and create the Docker image.

Set nightly to work with latest version​


Cargo Commands​

Create Workspace (Manual process)​

Filename: Cargo.toml

[workspace]

members = [
"binary-name",
"library-name"
]

Please gothrough the actix git repo for sample project.

Create Project​

# Creating binary
cargo new <package-name>

# Creating library
cargo new <library-name> --lib

Build the application​

cargo build

# Build spacific package
cargo build -p <package-name>

Run the application​

cargo run -p <package-name>
#example
cargo run -p mission-cli

Run the test​

cargo test

# Test perticular package
cargo test -p <package-name>