From a3b5f0bceaeeae4cc33a29b7a9200d5a82dea1ca Mon Sep 17 00:00:00 2001 From: Coin de Gamma Date: Thu, 5 Sep 2024 10:28:58 +0000 Subject: [PATCH] items++ --- src/db.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/db.rs b/src/db.rs index 6e64472..baa72a4 100644 --- a/src/db.rs +++ b/src/db.rs @@ -7,7 +7,7 @@ use std::fmt; // TODO: use this structure in HashSet of items -#[derive(Debug, PartialEq, Eq, Hash)] +#[derive(PartialEq, Eq, Hash)] pub struct Item { pub id: String, pub content: String @@ -21,7 +21,7 @@ impl Item { } impl fmt::Display for Item { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { writeln!(f, "{}", self.id)?; writeln!(f, "---------")?; writeln!(f, "{}", self.content) @@ -29,8 +29,10 @@ impl fmt::Display for Item { } pub fn test_items() { - let item1 = Item::from("item1".to_string()); - let item2 = Item::from("item2".to_string()); + let mut item1 = Item::from("item1".to_string()); + item1.content = "some content".to_string(); + let mut item2 = Item::from("item1".to_string()); + item2.content = "other content".to_string(); let mut hs = HashSet::::new(); hs.insert(item1);