thomcc / arcstr

Better reference counted strings for Rust
Apache License 2.0
114 stars 18 forks source link

Implement an `RcStr` (e.g. `Rc<str>`-alike) #33

Open thomcc opened 2 years ago

thomcc commented 2 years ago

That is: a thread-unsafe (e.g. !Send) equivalent to ArcStr. std::rc::Rc would be to RcStr as std::sync::Arc is to ArcStr). It would avoid needing to use atomic operations, but otherwise would support the same features.

This would probably take either a bunch of copy/pasted code, or a big refactor. Neither is exactly ideal, but I've wanted a Rc version of this a few times.

I'm not sure if this would be better as a separate crate. (Ideally not, as it would allow sharing code, but this might take renaming the arcstr::literal! macro, and honestly the arcstr name implies, well, Arc-equivalence, so the name is a bit weird).

gzz2000 commented 2 years ago

+1 on this!

thomcc commented 2 years ago

Hm, yeah, it would be a nice addition.