.cargo/vendor/proc-macro2/src/num.rs
raw| 1 | // TODO: use NonZero<char> in Rust 1.89+ |
| 2 | #[derive(Copy, Clone, Debug, PartialEq, Eq)] |
| 3 | pub struct NonZeroChar(char); |
| 4 | |
| 5 | impl NonZeroChar { |
| 6 | pub fn new(ch: char) -> Option<Self> { |
| 7 | if ch == '\0' { |
| 8 | None |
| 9 | } else { |
| 10 | Some(NonZeroChar(ch)) |
| 11 | } |
| 12 | } |
| 13 | |
| 14 | pub fn get(self) -> char { |
| 15 | self.0 |
| 16 | } |
| 17 | } |