unicode_escape/
error.rs

1/// Defines error types and implementations for decoding escape sequences.
2///
3/// This module contains the `DecodeError` enum and its associated implementations for displaying
4/// and handling decoding errors.
5use std::error::Error;
6use std::fmt;
7
8/// Represents the different types of errors that can occur during decoding.
9#[derive(Debug)]
10pub enum DecodeError {
11    /// Indicates an invalid escape sequence was encountered.
12    InvalidEscape,
13    /// Indicates an invalid hexadecimal character was encountered.
14    InvalidHexChar,
15    /// Indicates an invalid Unicode escape sequence was encountered.
16    InvalidUnicode,
17}
18
19impl fmt::Display for DecodeError {
20    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
21        write!(f, "{:?}", self)
22    }
23}
24
25impl Error for DecodeError {}