|
|
|
@ -18,7 +18,8 @@ impl Item {
|
|
|
|
|
pub fn from(s: String, c: String) -> Item { |
|
|
|
|
Item { id: s, content: c } |
|
|
|
|
} |
|
|
|
|
pub fn from_d(s: String) -> Item { |
|
|
|
|
// used only to search in HashSet
|
|
|
|
|
pub fn from_empty(s: String) -> Item { |
|
|
|
|
Item { id: s, content: String::from("") } |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -101,8 +102,7 @@ impl DB {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pub fn contains(&self, id: &String) -> bool { |
|
|
|
|
// TODO: check with content
|
|
|
|
|
let item = Item::from_d(id.clone()); |
|
|
|
|
let item = Item::from_empty(id.clone()); |
|
|
|
|
self.items.contains(&item) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|