backend #4

Merged
benjamyn merged 4 commits from backend into master 2024-11-29 06:15:17 -05:00
2 changed files with 8 additions and 7 deletions
Showing only changes of commit 4aaa6601c2 - Show all commits

View File

@ -17,12 +17,12 @@ impl BingoSquare {
#[derive(Deserialize)]
pub struct Meta {
name: String,
reason: String,
description: String,
}
impl Meta {
pub fn new(name: String, reason: String) -> Meta {
Meta { name, reason }
pub fn new(name: String, description: String) -> Meta {
Meta { name, description }
}
}
@ -35,6 +35,7 @@ pub struct BingoPool {
impl fmt::Display for BingoPool {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "Name: {}\n", self.meta.name).unwrap();
write!(f, "Description: {}\n\n", self.meta.description).unwrap();
for square in &self.squares {
write!(f, "Square: {}\n", square.option).unwrap();
}

View File

@ -1,12 +1,12 @@
[meta]
name = 'Test Bingo'
reason = 'Because its fucking funny'
description = 'Because its fucking funny'
[[squares]]
option = 'This is a test square'
option = 'Code compiles first try and no one believes you'
[[squares]]
option = 'This is a second test square'
option = 'There isnt a crate for that already'
[[squares]]
option = 'This is a third test square'
option = 'Someone tells you to use JS'