rust-ascii
rust-ascii copied to clipboard
Add literal macro
This macro enables us to write literal, compile-time, fixed-size ascii strings by writing
const HELLO: &[AsciiChar; 15] = ascii::literal!("Hello in ASCII!");
just as we would write literal, compile-time, fixed-size byte strings by writing
const HELLO: &[u8; 15] = b"Hello in bytes!";
This seems to be currently the only way to (safely) write a string such that its validity is checked at compile-time.