Type Definition fixedstr::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. Consult documentation for fstr or zstr for the same functions and traits.
In addition, the str4-str128 types implement core::ops::Add. 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);