Skip to content

Instantly share code, notes, and snippets.

@lovesegfault
Created November 1, 2017 05:31
Show Gist options
  • Save lovesegfault/c925e0cffa2ad132c978b3f08371bdc8 to your computer and use it in GitHub Desktop.
Save lovesegfault/c925e0cffa2ad132c978b3f08371bdc8 to your computer and use it in GitHub Desktop.
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