summaryrefslogtreecommitdiff
path: root/src/item.rs
blob: af5c2f874fa30a4cd1409c1d0ddc524012f0488a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Item {
    pub name : String,
    pub size : usize,
}

impl Item {
    pub fn new(name : &str, size : usize) -> Item {
        Item {
            name : String::from(name),
            size : size,
        }
    }

    pub fn is_mineral(&self) -> bool {
        if self.name == "Mineral" {
            true
        }
        else {
            false
        }
    }
}