fixed_len_str
This Rust library provides a procedural macro for declare a wrapper struct for an array with the size given by the tokens which dereferences to str
and a macro for create they from str
.
For a proper API documentation of one of length 12 see fixed_len_str_example.
Usage
use fixed_len_str::fixed_len_str;
fixed_len_str!(3);
fn main() {
let string = new_str3!("abc");
assert_eq!(string, "abc");
let string = FixedStr3::new(*b"abc");
assert_eq!(string, "abc");
let mut string = FixedStr3::default(); string.fill_zeroes_str("abc");
assert_eq!(string, "abc");
let mut string = FixedStr3::new([b'a', b'b', 0]);
string.fill_zeroes_char('c');
assert_eq!(string, "abc");
assert_eq!(string.as_bytes(), string.as_ref().as_bytes());
assert_eq!(string.clone().into_string(), String::from(string.as_ref()));
}