impl Display for Action

This commit is contained in:
Jimmy Cuadra 2019-07-23 00:26:46 -07:00
parent 4c7156b187
commit b88c621214

View File

@ -1,7 +1,7 @@
//! Types for the the *m.push_rules* event.
use std::{
fmt::{Formatter, Result as FmtResult},
fmt::{Display, Formatter, Result as FmtResult},
str::FromStr,
};
@ -142,6 +142,22 @@ pub enum Action {
__Nonexhaustive,
}
impl Display for Action {
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
let variant = match *self {
Action::Notify => "notify",
Action::DontNotify => "dont_notify",
Action::Coalesce => "coalesce",
Action::SetTweak(_) => "set_tweak",
Action::__Nonexhaustive => {
panic!("__Nonexhaustive enum variant is not intended for use.")
}
};
write!(f, "{}", variant)
}
}
impl FromStr for Action {
type Err = FromStrError;