just-string 2025.12.8

Container for various kinds of strings
Documentation
  • Coverage
  • 14.29%
    1 out of 7 items documented1 out of 2 items with examples
  • Size
  • Source code size: 13.0 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 490.7 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 13s Average build duration of successful builds.
  • all releases: 15s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Magicloud/just-string
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Magicloud

Just String

crates docs

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.