Expand description
Short, hot-path string primitive for the axess workspace.
ShortString is a value type optimized for short identifiers that
are hashed, compared, and cloned at high volume: event taxonomy tags,
factor names, routing discriminators, and similar.
The internal representation is an Umbra-style 16-byte stack value
(“German string” / Umbra-DB string): strings up to 12 bytes are
inlined with no allocation, &'static str is referenced in place
(also no allocation), and longer owned strings use a single
refcounted heap buffer that is shared on clone. The four-byte
prefix that powers the equality fast-path lives at a fixed offset
across all three variants, so prefix comparison is variant-agnostic.
The internal layout is documented in src/repr.rs and is the only
place in the axess workspace where unsafe is permitted; every
unsafe block there cites the invariant it relies on.
§Quick start
use axess_strings::ShortString;
let s = ShortString::new("auth.login_attempt.v2");
assert_eq!(s.as_str(), "auth.login_attempt.v2");
assert_eq!(s.len(), 21);
const KIND_LOGIN_V2: ShortString =
ShortString::from_static("auth.login_attempt.v2");
assert_eq!(KIND_LOGIN_V2, s);§Feature flags
| Feature | Default | Effect |
|---|---|---|
serde | yes | serde::Serialize / serde::Deserialize forwarding to/from a string. |
rkyv | no | rkyv Archive / Serialize / Deserialize forwarding to rkyv::string::ArchivedString. |
full | no | Both serde and rkyv. |
Structs§
- Short
String - Short, hot-path string primitive.