Displays available owned games for a GameNight.
This commit is contained in:
@@ -2,4 +2,5 @@ pub mod gamenight;
|
||||
pub mod user;
|
||||
pub mod config;
|
||||
pub mod participants;
|
||||
pub mod game;
|
||||
pub mod game;
|
||||
pub mod owned_games;
|
||||
18
gamenight-cli/src/domain/owned_games.rs
Normal file
18
gamenight-cli/src/domain/owned_games.rs
Normal file
@@ -0,0 +1,18 @@
|
||||
use std::{collections::HashMap, fmt::Display};
|
||||
|
||||
use crate::domain::game::Game;
|
||||
|
||||
|
||||
pub struct OwnedGames<'a>(pub &'a HashMap<String, Vec<Game>>);
|
||||
|
||||
impl<'a> Display for OwnedGames<'a> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
for (k,v) in self.0 {
|
||||
write!(f, "{k}:\n")?;
|
||||
for g in v {
|
||||
write!(f, "\t{}\n", g.name)?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user