Ben Chuanlong Du's Blog

It is never too late to learn.

Tips on Rust

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

https://lib.rs/

Rust Blessed is an unofficial guide to the Rust ecosystem.

Installation

Please refer to Tips on rustup for installing Rust using rustup (the recommended way for most users), and Install a Standalone Version of Rust in Linux for installing a global standalone version of Rust.

Install a Newer Version of Rust via PPA on Ubuntu

sudo apt-add-repository ppa:ubuntu-mozilla-security/rust-updates
sudo apt-get update
sudo apt-get install rustc

For details of the PPA ubuntu-mozilla-security/rust-updates, please refer to PPA for preparing rust toolchain updates for Firefox .

Rust Toolchains

  • cargo: package manager for Rust

  • rustup: version manager for Rust

  • rustc: compiler for Rust

  • clippy

  • rustfmt

Conditional Compilation in Rust

Conditional compilation for debug/release

#[cfg(debug_assertions)]
...

Key Concepts in Rust

Moves, copies and clones in Rust

General Tips and Traps

  1. Common newbie mistakes or bad practices Common Newbie Mistakes and Bad Practices in Rust: Bad Habits

  2. Iterator::for_each is preferred over a for loop; Range (..) is preferred over RangeInclusive (..=). For detailed discussions, please refer to Big performance problem with closed intervals looping #45222 , Performance difference among Range, RangeInclusive and reversed , Why is iterator so much faster? and Why does iteration over an inclusive range generate longer assembly in Rust? .

Pattern Matching in Rust

Please refer to Useful Rust Crates for detailed discussions.

Machine Learning

Please refer to Rust for Machine Learning for detailed discussions.

Parallel, Multithreading and Concurrency in Rust

loom

is a concurrency permutation testing tool for Rust.

sanitizers

This project is the home for Sanitizers: AddressSanitizer, MemorySanitizer, ThreadSanitizer, LeakSanitizer, and more The actual code resides in the LLVM repository. Here we keep extended documentation, bugfixes and some helper code.

rayon A data parallelism library for Rust.

http://worthe-it.co.za/programming/2018/10/03/going-four-times-faster-with-multithreading.html

https://skipworth.io/posts/rust-wc-threads/

https://crates.io/crates/scoped-threadpool

Rust GUI

Optimize Compiling of Rust Projects

Fast Rust Builds has a detailed discuss on how to optimize the compiling time of rust projects.

Cool Rust Projects

https://github.com/rajasekarv/native_spark

https://github.com/andygrove/ballista

https://github.com/weld-project/weld

https://github.com/rbatis/rbatis

https://github.com/dclong?language=rust&tab=stars

https://github.com/rust-unofficial/awesome-rust

https://github.com/yewstack/yew

https://github.com/valeriansaliou/sonic

Good Blogging on Rust

Good Forums

Rust Magazine

Tutorials

Rust Language Cheat Sheet

How to learn modern Rust

Jon Gjengset's Video Tutorials (Medium to Advanced)

Rust on YouTube

Rust Crash Course | Rustlang

https://github.com/rust-unofficial/awesome-rust

https://kerkour.com/

References

Comments