Crates.io | proc_strarray |
lib.rs | proc_strarray |
version | 1.7.0 |
created_at | 2024-07-29 10:10:56.805158+00 |
updated_at | 2025-05-30 13:19:15.787911+00 |
description | Create const u8 array from str or byte str literal |
homepage | https://gitlab.com/hsn10/proc_strarray |
repository | https://gitlab.com/hsn10/proc_strarray.git |
max_upload_size | |
id | 1318719 |
size | 35,013 |
Procedural macro proc_strarray::str_array
creates const u8 array from str literal.
Variant proc_strarray::str_array0
creates zero terminated u8 array.
Macro str_array takes three arguments:
str_repeat
repeats str or byte str literal n times.str_repeat0
repeats str or byte str literal n times and adds NUL termination.str_repeat_bytes
repeats str or byte str literal n times as byte
slice.str_repeat_bytes0
repeats str or byte str literal n times as byte
slice and adds NUL termination.str_len
returns length of str or byte str literal.str_len0
returns length of zero terminated str or byte str literal.str_bytes
creates byte slice from str or byte str literal.str_bytes0
creates zero terminated byte slice from str or byte str literal. // This code will create const array of u8
// named STRU from content of "stru" str literal.
use proc_strarray::str_array;
str_array!(STRU, "stru");
// check if newly created array have length 4
assert_eq!(STRU.len(), 4);
// check created array if first character is 's'
assert_eq!(STRU[0], 's' as u8);
rustdoc generated documentation can be found at docs.rs
proc_strarray uses same MIT/APL2 dual license as Rust.
MSRV 1.56 and it will stay for all 1.X versions.