macro_rules! ascii_str {
($str:expr $(,)*) => { ... };
}
Expand description
Constructs an AsciiStr
constant from an ascii string,
§Compile-time errors
This macro produces a compile-time error by indexing an empty array with the index of the first non-ascii byte.
§Example
use const_format::ascii_str;
let fooo = ascii_str!("hello");
assert_eq!(fooo.as_str(), "hello");
// You can pass constants as arguments!
const BAR_S: &str = "world";
let bar = ascii_str!(BAR_S);
assert_eq!(bar.as_str(), "world");
ⓘ
use const_format::ascii_str;
let fooo = ascii_str!("Γειά σου Κόσμε!");