use std::fmt; use coordinate; #[derive(Clone)] pub enum Inhabitant { Critter { species: String, offense: i32, defense: i32, size: i32, energy: u32, posture: i32, position: coordinate::Coordinate, direction: coordinate::Direction, }, Nothing, Rock, Food { amount: i32, }, } impl fmt::Debug for Inhabitant { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { Inhabitant::Nothing => write!(f, "__"), Inhabitant::Rock => write!(f, "RR"), Inhabitant::Food { amount: amount } => { if amount < 50 { write!(f, "ff") } else if amount < 100 { write!(f, "fF") } else if amount < 200 { write!(f, "Ff") } else { write!(f, "FF") } }, Inhabitant::Critter {..} => write!(f, "CC") } } }