#string

4 articles about string

rustAugust 6, 2025

Where do string literals (&str) live?

String literals live in the binary's read-only data with a 'static lifetime — what that means for allocation, copying, and returning them.

rustAugust 4, 2025

Why &str Won't Fit &String in Rust: Fun Fixes for String Mismatches!

Why passing a &str where a &String is expected fails to compile, what deref coercion does and doesn't do, and how to fix the mismatch.

rustJuly 30, 2025

How does Cow<'a, B> (Copy-on-Write) work in Rust?

Cow<'a, B> lets a function borrow when it can and allocate only when it must. How copy-on-write works and when it pays for itself.

rustJuly 3, 2025

String vs. &str – Which to Use and When?

String vs str in Rust, covering memory management, ownership, and when to use each type.