implement Format instead of just ToString
This commit is contained in:
parent
676c71cd45
commit
59fc76a2d4
10
src/exit.rs
10
src/exit.rs
|
@ -2,6 +2,7 @@ use crate::Position;
|
|||
use std::str::FromStr;
|
||||
use std::error::Error;
|
||||
use std::fmt;
|
||||
use std::fmt::{Display, Formatter};
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub enum Transition {
|
||||
|
@ -32,9 +33,9 @@ impl From<&str> for Transition {
|
|||
}
|
||||
}
|
||||
|
||||
impl ToString for Transition {
|
||||
fn to_string(&self) -> String {
|
||||
match &self {
|
||||
impl Display for Transition {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "{}", match &self {
|
||||
Transition::FadeToWhite => " FX fade_w",
|
||||
Transition::FadeToBlack => " FX fade_b",
|
||||
Transition::Wave => " FX wave",
|
||||
|
@ -44,8 +45,7 @@ impl ToString for Transition {
|
|||
Transition::SlideLeft => " FX slide_l",
|
||||
Transition::SlideRight => " FX slide_r",
|
||||
Transition::None => "",
|
||||
}
|
||||
.to_string()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue