Expand description
This module implements the no_std version of zstr, which are
zero-terminated strings of fixed maximum lengths.
Type zstr<N> can store strings consisting of up to N-1 bytes
Also, it is assumed that the zstr may carray non-textul data and therefore
implements some of the traits differently.
zstr<N> also implements the core::ops::IndexMut trait for usize.
This allows destructive changes to single bytes, such as
ⓘ
let mut s = <zstr<8>>::from("abcd");
s[0] = b'A';
assert_eq!(&s[0..3],"Abc");The consequence of IndexMut is that the buffer may not represent an utf8 string. In fact, a zstr::from_raw method also exists. In constrast, fstr and the alias types str4-str256 do not implement IndexMut. This distinction of zstr means also means that the core::ops::Index traits are separately implemented for the Range types.
Structs§
- zstr
zstr<N>: zero-terminated utf8 strings of size up to N bytes. Note that zstr supports unicode, so that the length of string in characters may be less than N.