Created
November 1, 2017 05:31
-
-
Save lovesegfault/c925e0cffa2ad132c978b3f08371bdc8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::fmt; | |
// Status is really just a boolean with better naming. | |
enum Status { | |
Alive, | |
Dead, | |
} | |
impl fmt::Display for Status{ | |
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result{ | |
let character; | |
match self{ | |
&Status::Alive => { | |
character = "■" | |
} | |
&Status::Dead => { | |
character = "·" | |
} | |
} | |
write!(f, "{}", character) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment