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