Procedural macros for str literals
Convert str to const [ u8; _ ] array
Procedural macro proc_strarray::make_array
creates const u8 array from str literal.
Variant proc_strarray::make_array0
creates zero terminated u8 array.
Repeat str
- function
str_repeat
repeats str literal n times. - function
str_repeat0
repeats str literal n times and adds zero termination.
Misc functions
- Utility function
str_len
returns length of str literal.
Usage
// This code will create const array of u8
// named STRU from content of "stru" str literal.
use make_array;
make_array!;
// check if newly created array have length 4
assert_eq!;
// check created array if first character is 's'
assert_eq!;