Skip to content

Samuel-Berger/rustbook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rustbook

Learn Rust via the Rust Programming Language book. The book can be accessed offline with rustup docs --book. Everything will be done via *NIX operating systems. See the book to adopt the notes for a Windows enviroment.

Learn Rust in Y minutes is also a nice source for notes.

https://doc.rust-lang.org/stable/rust-by-example/flow_control/if_let.html

Installation and Maintainance of Rust

Install and update path: curl https://sh.rustup.rs -sSf | sh and source $HOME/.cargo/env. Keep up to date by running rustup update.

Install the automatic formatter (same as linter?) via rustup: rustup component add rustfmt. The formatter is invoked by

Basic

Format the code, compile and run:

rustfmt main.rs && rustc main.rs && ./main

fn main() is always needed.

A macros i denoted by !. So println! calls a macro, and println calls a function.

Cargo

In Rust, packages of code are referred to as crates. Cargo expects your source files to live inside the src directory.

When creating a new crate a directory structure will be created and initiated with a git repository.

Crete new: cargo new hello_cargo; check: cargo check; build: cargo build; build for release: cargo build --release; build documentation provided by all of your dependencies locally and open it in your browser: cargo doc --open.

Loops

loop {
    break;
}

About

Learn Rust via the Rust Book

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages