proc-macro2 1.0.103

A substitute implementation of the compiler's `proc_macro` API to decouple token-based libraries from the procedural macro use case.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// TODO: use NonZero<char> in Rust 1.89+
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub struct NonZeroChar(char);

impl NonZeroChar {
    pub fn new(ch: char) -> Option<Self> {
        if ch == '\0' {
            None
        } else {
            Some(NonZeroChar(ch))
        }
    }

    pub fn get(self) -> char {
        self.0
    }
}