summaryrefslogtreecommitdiff
path: root/src/item.rs
blob: f9c74905fb762f80d4dade153fc90319fc48e31e (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 == "Iron" {
            true
        }
        else {
            false
        }
    }
}