5 ms·
I’ve been using smartstrings, which is both excellent and maintained. https://github.com/bodil/smartstring https://github.com/bodil/smartstring
by totalperspectiv 6y ago
I’ve been using smartstrings, which is both excellent and maintained. https://github.com/bodil/smartstring https://github.com/bodil/smartstring
- simias 6y agoAh, nice, I was looking at the smallstring package that's appears abandoned. I'll be sure to check this one out. The good thing about having a decent type system is that I expect that transitioning to smartstrings should be painless! Thank you for that.
- simias 6y agoIn case somebody stumbles upon this conversation in the future: I just migrated a project to use smartstrings and it works a bit differently from smallvec. Smallvec lets you decide how big you want to make the static buffer before it allocates, whereas smartstring's static buffer size is alsways `size_of::<String>() - 1`, that is 23 bytes on 64 bit architectures and 11 on 32 bits. If I want, say, a static 128B string smartstring won't do any better than std::string::String. It's still a very nice lib though, and a smart optimization, but it doesn't cover all of my use cases for small string buffers.