This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
Github | Crates.io | Docs.rs | Preliminary Benchmarks
I created this because I found myself cloning String all the time while working on a large project. Essentially, I had several HashMaps and no simple way to borrow the String for the lifetime I needed so ended up with several clones. It seemed silly to me to be copying string data over and over when most strings are immutable.
Additionally, I wanted a type that would combine string literals with heap based strings as I found myself often having struct fields that could be a literal or a heap allocated String. I ended up allocating in several cases for something that was already static.
The inline string type is due to needing some very short string creation from primitives and it seemed wasteful to do a heap allocation.
I was kinda suprised nobody had created a string type like this yet. (UPDATE: This is very similar to "kstring" crate I just learned). There were several candidates for inline strings, some ref counted strings, but I couldn't find a string crate that did all three as a single combined type.
EDIT: This crate is considered "beta" - it has 88% test coverage atm, but only some light real world usage in my hobby projects. Extra testing and feedback is welcome, but it may not be ready for hardcore production just yet.
Post Details
- Posted
- 2 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/rust/commen...