ParkMyCar/compact_str
View on GitHub ↗ ★ 882 Rust
A memory efficient string type that can store up to 24* bytes on the stack
3 mentions on Hacker News by 3 people: 0 stories, 3 comments · first 2022-06-25 · latest 2025-09-12
20082026
-
…otherwise it is stored on the heap (with a pointer, a length, and a capacity - also 24 bytes) https://github.com/ParkMyCar/compact_str How cool is that (Discussed here https://news.ycombinator.com/item?id=41339224 )
comment by nextaccountic · 2025-09-12 · in UTF-8 is a brilliant design -
…with actual string data. There's a nice explanation on their readme[2]. Love tricks like this. [1]: https://github.com/ParkMyCar/compact_str [2]: https://github.com/ParkMyCar/compact_str?tab=readme-ov-file#...
comment by unshavedyak · 2024-08-24 · in Small Strings in Rust: smolstr vs. smartstring (2020) -
https://github.com/ParkMyCar/compact_str https://old.reddit.com/r/rust/comments/t33hxp/announcing_com...
comment by 24bytes · 2022-06-25 · in What is `Box<str>` and how is it different from `String` in Rust?