Rust Programming

Documentation

The Rust Reference
The Rust Programming Language

Asynchronous Programming in Rust

Blog

Fearless Concurrency with Rust
Abstraction without overhead: traits in Rust

Virtual Structs Part 1: Where Rust’s enum shines
Virtual Structs Part 2: Classes strike back
Virtual Structs Part 3: Bringing Enums and Structs Together

Unsafe

The Rustonomicon

  • the meaning of (un)safety
  • unsafe primitives provided by the language and standard library
  • techniques for creating safe abstractions with those unsafe primitives
  • subtyping and variance
  • exception-safety (panic/unwind-safety)
  • working with uninitialized memory
  • type punning
  • concurrency
  • interoperating with other languages (FFI)
  • optimization tricks
  • how constructs lower to compiler/OS/hardware primitives
  • how to not make the memory model people angry
  • how you’re going to make the memory model people angry


Books

Fullstack Rust – Adding State to Our Web App


Syntax

unit type

Primitive Type unit
What is the purpose of the unit type in Rust?

static

fn spawn<F>(f: F) where F: 'static, ...
fn scoped<'a, F>(f: F) -> JoinGuard<'a> where F: 'a, ...

constraint

'static no borrowed data is permitted in the closure
'a cannot escape the scope of any data borrowed by the closure

trait

trait ClickCallback {
    fn on_click(&self, x: i64, y: i64);
}
struct Button {
    listeners: Vec<Box<ClickCallback>>,
    ...
}

trait object

  • traits are types, but they are “unsized”
  • they are only allowed to show up behind a pointer like Box (which points onto the heap) or & (which can point anywhere)
  • Static and dynamic dispatch
&ClickCallback no borrowed data is permitted in the closure
Box cannot escape the scope of any data borrowed by the closure

Future trait

The Future Trait
Build an Executor


Tutorials

NICLAS ROSSBERGER

Rust-01: Why am I learning Rust?
Rust-02: The beginning
Rust-03: Improving the simple program

Medium

C++ vs Rust: an async Thread-per-Core story

How to Idiomatically Use Global Variables in Rust

Java

ExecutorService – Waiting for Threads to Finish
Guide to java.util.concurrent.Future


YouTube

Andrew Sharp

Learn Rust Part 1: numbers, variables, types and functions
Learn Rust Part 2: Structs
Learn Rust Part 3: References
Learn Rust Part 4: Mutable References
Learn Rust Part 5: Ownership
Learn Rust Part 6: Borrowing
Learn Rust Part 7: Lifetimes
Learn Rust Part 8: Lifetimes with Structs
Learn Rust Part 9: Constant Items and the Static Lifetime
Learn Rust Part 10: Methods and Associated Functions

Leave a Reply

Your email address will not be published.