/learn-rust

Learn rust lang

Primary LanguageRust

Learn Rust

https://www.rust-lang.org/

Topics

Installation

with rustup:

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

Other installation methods are available at https://forge.rust-lang.org/infra/other-installation-methods.html.

update:

rustup update
❯ rustc --version
rustc 1.68.2 (9eb3afe9e 2023-03-27)

Visual Studio Code: https://code.visualstudio.com/docs/languages/rust

Build

rustc src/main.rs

Example:

❯ rustc src/main.rs 

❯ ./main 
Hello, world!

Cargo

New Project

cargo new hello

Example:

❯ cargo new print
     Created binary (application) `print` package

or

cargo init print

Example:

❯ cargo init print
     Created binary (application) `print` package

Run

cargo run

Example:

❯ cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.00s
     Running `target/debug/hello`
Hello, world!

Build

cargo build

Example:

❯ cargo build
    Finished dev [unoptimized + debuginfo] target(s) in 0.00s

Resources