Destructuring Rust strings
summary
Covers concrete Rust types and conversion patterns: String = heap allocated, mutable, UTF‑8 and &str = borrowed, immutable slice, shows Cow\<str\> used to avoid allocations by returning a borrow unless filtering forces an owned string, and demonstrates CString/CStr for null‑terminated FFI with examples calling into C via raw pointers and unsafe from_raw conversions. Explains OsStr/OsString for platform bytes and why indexing fails on UTF‑8, and gives the practical tradeoffs and when allocation actually happens.
AI-written summary · about
chapters (9)
- 0:00Introduction
- 1:04Rust string types overview
- 2:25Prerequisites and setup
- 2:46String type in Rust
- 5:40Str type and references
- 8:10Cow type explained
- 12:27OS string and C string
- 15:47FFI and unsafe operations
- 16:43Q&A session
related talks
28mWriting Idiomatic Libraries in Rust
40mAdvanced Rust Programming Techniques
25mIntro and Overview to Rust
18mLearning Systems Programming with Rust
35mLet’s Talk About Rust
51mAllocating Less: Really Thin Rust Cloud Apps
21mUnicode in Rust - Illustrated by Kanji
31mA Rust Crate that also quacks like a modern C++ Library
