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::str::FromStr;
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
use std::fmt::{Display, Formatter};
|
||||||
|
|
||||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||||
pub enum Transition {
|
pub enum Transition {
|
||||||
|
@ -32,9 +33,9 @@ impl From<&str> for Transition {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ToString for Transition {
|
impl Display for Transition {
|
||||||
fn to_string(&self) -> String {
|
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||||
match &self {
|
write!(f, "{}", match &self {
|
||||||
Transition::FadeToWhite => " FX fade_w",
|
Transition::FadeToWhite => " FX fade_w",
|
||||||
Transition::FadeToBlack => " FX fade_b",
|
Transition::FadeToBlack => " FX fade_b",
|
||||||
Transition::Wave => " FX wave",
|
Transition::Wave => " FX wave",
|
||||||
|
@ -44,8 +45,7 @@ impl ToString for Transition {
|
||||||
Transition::SlideLeft => " FX slide_l",
|
Transition::SlideLeft => " FX slide_l",
|
||||||
Transition::SlideRight => " FX slide_r",
|
Transition::SlideRight => " FX slide_r",
|
||||||
Transition::None => "",
|
Transition::None => "",
|
||||||
}
|
})
|
||||||
.to_string()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue