Implement Display for Whitespace
This commit is contained in:
parent
3d0ae02b0a
commit
c6c686d514
@ -209,6 +209,17 @@ pub enum Whitespace {
|
||||
CarriageReturn,
|
||||
}
|
||||
|
||||
impl Display for Whitespace {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Whitespace::Space => write!(f, " "),
|
||||
Whitespace::Tab => write!(f, "\t"),
|
||||
Whitespace::Newline => write!(f, "\n"),
|
||||
Whitespace::CarriageReturn => write!(f, "\r"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl TryFrom<char> for Whitespace {
|
||||
type Error = &'static str;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user