Skip to content

String vs. &str

blog.sulami.xyz
3 pointssulami2 comments
On HN

Comments

This means it has a known size (The same as a usize.)

Double that of a usize, since str is an unsized type and needs a fat pointer.

For sure one of the more concise and practical guides I've seen on the topic. Substrings make for a fantastic Northstar example.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.