macro_rules! fix_str {
($($input:tt)*) => { ... };
}Expand description
Builds a &'static FixStr from a string literal.
Every byte is checked at expansion time to be printable ASCII
(0x20-0x7e); a literal containing anything else is a compile error
naming the offending position. Usable in const context and in ordinary
expressions alike, so it is the way to write a FixStr literal - reach
for FixStr::from_ascii_unchecked only for runtime bytes, which this
macro cannot see.
const BEGIN_STRING: &FixStr = fix_str!("FIXT.1.1");
assert_eq!(BEGIN_STRING.as_utf8(), "FIXT.1.1");ⓘ
// SOH is a control character - rejected at compile time.
let bad = fix_str!("FIXT\x01");