Skip to main content

Module smallstr

Module smallstr 

Source
Expand description

A UTF-8 string backed by SmallVec.

SmallStr<N> stores up to N bytes inline on the stack. When the string grows beyond N bytes, it spills to a heap-allocated buffer.

§Examples

use planck_noalloc::smallstr::SmallStr;

let mut s = SmallStr::<16>::new();
s.push_str("hello");
s.push(' ');
s.push_str("world");
assert_eq!(s.as_str(), "hello world");
assert!(s.is_inline());

Structs§

FromUtf8Error
Error returned when constructing a SmallStr from invalid UTF-8 data.
SmallStr
A UTF-8 string that stores up to N bytes inline, spilling to the heap when exceeded.