Skip to main content

Module smallbytestr

Module smallbytestr 

Source
Expand description

A byte string backed by SmallVec.

SmallByteStr<N> stores up to N bytes inline on the stack. When the buffer grows beyond N bytes, it spills to a heap-allocated buffer. Unlike SmallStr, no UTF-8 validity is enforced.

§Examples

use planck_noalloc::smallbytestr::SmallByteStr;

let mut bs = SmallByteStr::<8>::new();
bs.push(0x48); // 'H'
bs.push(0x69); // 'i'
assert_eq!(bs.as_bytes(), b"Hi");
assert!(bs.is_inline());

Structs§

SmallByteStr
A byte string that stores up to N bytes inline, spilling to the heap when exceeded.