diff --git a/src/db.rs b/src/db.rs index 48210fd..3601c4d 100644 --- a/src/db.rs +++ b/src/db.rs @@ -1,13 +1,29 @@ use std::collections::HashSet; +use std::hash::{Hash}; use std::fs; use std::io::{self, Write, BufRead}; +// TODO: use this structure in HashSet of items +#[derive(Debug, PartialEq, Eq, Hash)] +pub struct Item { + pub id: String, + pub content: String +} + +impl Item { + pub fn from(s: String) -> Item { + Item { id: s, content: String::from("") } + } +} + + pub struct DB { pub items: HashSet:: } + impl DB { pub fn new(path: &str) -> io::Result { let file = fs::File::open(path)?;