| Crates.io | just-string |
| lib.rs | just-string |
| version | 2025.12.8 |
| created_at | 2025-12-08 05:15:55.806005+00 |
| updated_at | 2025-12-08 09:00:18.751243+00 |
| description | Container for various kinds of strings |
| homepage | |
| repository | https://github.com/Magicloud/just-string |
| max_upload_size | |
| id | 1972760 |
| size | 13,049 |
This is a container to hold various kinds of strings in Rust, for user who does not care about the (performance) differences in his case.
And this container tries to be transparent, which means in most cases, user does not have to extract the string out to use them. But mutating them must be done by getting the inner string out. The implementation does not support creating a new string in place, or mutating to original strings.
The only thing user needs to care is defined as:
enum JustString<'a> {
RefStr(&'a str),
CowStr(Cow<'a, str>),
BoxStr(Box<str>),
RefString(&'a String),
String(String),
}
There are five kinds of strings could be held by this container. I did not impl Into<JustString<'_>> sololy because knowing what is putting into the container every time using it might be helpful.
A lot of other trais are implemented. Mostly copied from what String does. And Serialize, just to omit the tags. The core trais are AsRef and Deref.