Type Alias str256

Source
pub type str256 = tstr<256>;
Expand description

Each type strN is represented underneath by a [u8;N] with N<=256. The first byte of the array always holds the length of the string. Each such type can hold a string of up to N-1 bytes, with max size=255. These types represent the best combination of [fstr] and zstr in terms of speed and memory efficiency.
In addition, the str4-str128 types implement core::ops::Add in a way that two str8 strings will always concatenate to str16, and similarly for all other strN types up to str128.

  let c1 = str8::from("abcd");
  let c2 = str8::from("xyz");
  let c3 = c1 + c2;
  assert_eq!(c3,"abcdxyz");
  assert_eq!(c3.capacity(),15);

Aliased Typeยง

struct str256 { /* private fields */ }