diff options
author | Markus Unterwaditzer <markus@unterwaditzer.net> | 2021-11-26 18:38:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-26 18:38:58 +0100 |
commit | dced8066f77f570dd3e396ec3570c71aa86c454e (patch) | |
tree | 2fb81d5f411319948c135dfaaa78bc5da6783621 /src/never.rs | |
parent | 029c13426634e58adb3996c9a5e4d79c3e8437f2 (diff) |
Read html from io::BufRead (#8)
Diffstat (limited to 'src/never.rs')
-rw-r--r-- | src/never.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/never.rs b/src/never.rs new file mode 100644 index 0000000..b4bb371 --- /dev/null +++ b/src/never.rs @@ -0,0 +1,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 {} |