Expand description
Borrowed-slice string view that shares a parent Arc<str>.
StrRef is a lightweight wrapper around an owning Arc<str> plus
byte-range offsets. Cloning it is an atomic Arc bump plus two
word-sized copies — no heap allocation — so methods like slice,
split.first, substring can return a view into their input
without allocating a fresh Arc<str> per row.
Invariants (enforced at construction):
start <= end <= parent.len().parent[start..end]is valid UTF-8 (the parent is, and we never split between code units — callers construct slices viastr::char_indicesor ASCII-only byte offsets).
as_str() returns the view slice. Deref<Target=str> /
AsRef<str> allow existing string APIs (len, chars, find, memchr,
etc.) to work against a StrRef transparently.