Skip to main content

Module str

Module str 

Source
Expand description

Small string optimization with stack allocation for short strings.

Str stores strings up to 23 bytes inline, avoiding heap allocation for typical short strings. Longer strings use reference-counted heap storage with O(1) cloning.

Structs§

Str
A Str is a string type that has the following properties:
StrMut
Mutable, growable counterpart of Str: same inline layout for strings up to 23 bytes, heap-backed above.

Enums§

CowStr
A clone-on-write smart pointer for strings with small string optimization.

Traits§

IntoStr
Convert value to Str/StrMut using fmt::Display, potentially without allocating.
StrExt
Extension trait for str to provide _str versions of methods that return an allocated String.

Type Aliases§

Utf8Error
An error type for UTF-8 validation.
Utf8ErrorMut
An error type for UTF-8 validation.