Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
41 lines (29 sloc) 616 Bytes

Rust getting started

Install and setup

$ sudo apt-get update
$ sudo apt-get -y upgrade

$ curl --proto '=https' --tlsv1.2 -sSf | sh
$ source $HOME/.cargo/env

Create project

$ cargo new cli
     Created binary (application) `cli` package
$ cd cli

Write Rust code

Below is the content of the src/ file.

use std::env;

fn main() {
    let args: Vec<String> = env::args().collect();
    println!("{}", String::from("Hello ") + &args[1]);

Compile and run

$ cargo build --release
$ target/release/cli Rust
Hello Rust
You can’t perform that action at this time.