arcstr: A better reference-counted string type.

Build Status codecov Docs Latest Version

Or, "types" hopefully — plural. The intent is for it to have a couple of those.

It just has one at the moment: ArcStr, which is the important one anyway, and has over Arc<str>.

It also has all the stuff you'd expect like optional serde support, no_std, etc.

Planned funtionality

So right, yeah, I did mention that "really the intent is for the crate to have a couple of those". What did I mean by that? Well, there are a few things you can build on ArcStr in not much code that are pretty nice:

Substr Type

Essentially an ergonomic (ArcStr, Range<usize>), which can be used to avoid allocation when creating a lot of ranges over the same string. A use case for this is parsers and lexers (Note that in practice I might use Range<u32> and not Range<usize>).

Key type

Essentially this will be an 8-byte wrapper around ArcStr that allows storing small 7b-or-fewer strings inline, without allocation. It will be 8 bytes on 32-bit and 64-bit platforms, since 3b-or-fewer is not compelling.

Actually, I need to do some invesigation that 7b isn't too small too. The idea is for use as map keys or other small frequently repeated identifiers.