[Pre-RFC] ASCII Type & Literals

I don't see a reason to have literals when the full character set is representable with normal string literals (c and b strings are necessary because they're strict supersets of UTF-8 rather than subsets). Instead, just use the const conversion functions that already exist.

A single ascii! macro could convert both char and string literals:

macro_rules! ascii {
    ($a:literal) => {{
        match ($a).as_ascii() {
            Some(a) => a,
            None => panic!("invalid ASCII literal"),
        }
    }}
}
1 Like