Files
dotdenote/assets/docker/notes/20240510T112034--learning-rust__programming_rust.org
andros 000a24234c Add App Store screenshots, demo notes, and fix theme propagation
- 3 screenshots at 1284x2778 (iPhone 6.5"): note list, note detail, settings
- Docker WebDAV setup with 9 demo notes in Denote format for local screenshots
- Fix theme not applying to NoteListView and NoteEditorView: move tint/preferredColorScheme from App.body (Scene) to RootView.body (View) so @Observable tracking works correctly
- NoteEditorView (sheet) now also gets preferredColorScheme and tint directly
- Add debug.password UserDefaults fallback in DEBUG builds for screenshot automation
2026-05-26 11:45:47 +02:00

41 lines
1020 B
Org Mode

#+title: Learning Rust
#+date: [2024-05-10 Fri]
#+filetags: :programming:rust:
#+identifier: 20240510T112034
* Why Rust?
- Memory safety without garbage collection
- Zero-cost abstractions
- Fearless concurrency
- Great tooling (cargo, clippy, rustfmt)
* Ownership Rules
1. Each value has exactly one owner
2. When the owner goes out of scope, the value is dropped
3. You can have either one mutable reference or many immutable ones
#+begin_src rust
fn main() {
let s1 = String::from("hello");
let s2 = s1; // s1 is moved, no longer valid
println!("{}", s2);
}
#+end_src
* The Borrow Checker
The borrow checker enforces ownership rules at compile time. This eliminates entire classes of bugs:
- Use-after-free
- Double-free
- Data races
- Null pointer dereferences
* Resources
- [[https://doc.rust-lang.org/book/][The Rust Book]] — start here
- [[https://doc.rust-lang.org/rust-by-example/][Rust by Example]] — hands-on
- [[https://rustlings.cool/][Rustlings]] — small exercises