blob: b4bb3711b942d667306a064484f87b243d257cef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
use std::error;
use std::fmt;
/// Definition of an empty enum.
///
/// This is used as the error type in situations where there can't be an error. A `Result<T, Never>`
/// can be safely unwrapped and the `unwrap()` may be optimized away entirely.
///
/// This error is typically encountered when attempting to get tokens from the `Tokenizer`. Call
/// [`Tokenizer::infallible`] if you wish to avoid unwrapping those results yourself.
pub enum Never {}
impl fmt::Display for Never {
fn fmt(&self, _: &mut fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
match *self {}
}
}
impl fmt::Debug for Never {
fn fmt(&self, _: &mut fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
match *self {}
}
}
impl error::Error for Never {}
|