1 2 3 4 5 6 7 8 9 10 11 12 13
use std::fmt::{self, Debug, Formatter}; pub enum TextError { UnescapeError(usize, Box<str>), } impl Debug for TextError { fn fmt(&self, f: &mut Formatter) -> fmt::Result { match self { TextError::UnescapeError(p, c) => write!(f, "UnescapeError: Fail to unescape {} at position {}", c, p), } } }