[−][src]Module show_notes::e014
Stringing things along
- Date: April 24, 2016
- Subject:
Strings
&str
s andVec
s and slices (and Unicode) -- oh, my! - Audio
Notes
This episode, I take a deep dive on strings in Rust, looking at the
differences between String
and &str
, discussing Unicode a bit, and then
expanding the discussion to think about how these types relate to the types
they're built on (like Vec
).
Corrigenda
Listener Nev pointed out to me that I got it wrong when describing how
&str
data is stored. It is not stack-allocated, but rather goes in the
data segment. I should have said statically-allocated, not
stack-allocated. Thanks to Nev for the correction!
Links
- Strings:
- The Rust Book
- Rust by Example
str
docs:String
- Dereferencing
Sponsors
- Aleksey Pirogov
- Chris Palmer
- Derek Morr
- Hamza Sheikh
- Lachlan Collins
- Leif Arne Storset
- Luca Schmid
- Micael Bergeron
- Pascal Hertleif
- Ralph Giles ("rillian")
- Ralph "FriarTech" Loizzo
- reddraggone9
- Ryan Ollos
- Vesa Kaihlavirta
- William Roe
(Thanks to the couple people donating who opted out of the reward tier, as well. You know who you are!)
Become a sponsor
Contact
- New Rustacean:
- Twitter: @newrustacean
- Email: [email protected]
- Chris Krycho
- GitHub: chriskrycho
- Twitter: @chriskrycho
Modules
demo_deref | Demonstrate dereferencing. (You'll want to read this example carefully.) |
Functions
demonstrate_unicode | Print a 🚀, just because we can. |
get_a_slice | Get a string slice. Note the required lifetime specifier on the type! |
get_a_string | Get a |
get_a_string_with_capacity | Get a |
get_back_some_unicode | |
show_from_behavior | It's easy enough to get a |