roguelike-game/src/game_log.rs

18 lines
337 B
Rust

#[derive(Default)]
pub struct GameLog {
pub entries: Vec<String>,
}
impl GameLog {
pub fn new<S: ToString>(first_entry: S) -> Self {
let mut log = GameLog::default();
log.append(first_entry);
log
}
pub fn append<S: ToString>(&mut self, s: S) {
self.entries.push(s.to_string());
}
}