impl Display for Action
This commit is contained in:
parent
4c7156b187
commit
b88c621214
@ -1,7 +1,7 @@
|
|||||||
//! Types for the the *m.push_rules* event.
|
//! Types for the the *m.push_rules* event.
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
fmt::{Formatter, Result as FmtResult},
|
fmt::{Display, Formatter, Result as FmtResult},
|
||||||
str::FromStr,
|
str::FromStr,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -142,6 +142,22 @@ pub enum Action {
|
|||||||
__Nonexhaustive,
|
__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 {
|
impl FromStr for Action {
|
||||||
type Err = FromStrError;
|
type Err = FromStrError;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user