roguelike-game/src/game_log.rs

18 lines
337 B
Rust
Raw Normal View History

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