entity_tag/
entity_tag_error.rs

1use core::fmt::{self, Display, Formatter};
2#[cfg(feature = "std")]
3use std::error::Error;
4
5#[derive(Debug, Clone, Copy, Eq, PartialEq)]
6/// Possible errors of `EntityTag`.
7pub enum EntityTagError {
8    MissingStartingDoubleQuote,
9    MissingClosingDoubleQuote,
10    InvalidTag,
11}
12
13impl Display for EntityTagError {
14    #[inline]
15    fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), fmt::Error> {
16        match self {
17            EntityTagError::MissingStartingDoubleQuote => {
18                f.write_str("the opaque tag misses the starting double quote")
19            },
20            EntityTagError::MissingClosingDoubleQuote => {
21                f.write_str("the opaque tag misses the closing double quote")
22            },
23            EntityTagError::InvalidTag => f.write_str("invalid tag"),
24        }
25    }
26}
27
28#[cfg(feature = "std")]
29impl Error for EntityTagError {}