summaryrefslogtreecommitdiff
path: root/src/mass.rs
blob: 71723cd0f84ef6a1894ac84292647ea45789fe06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use downcast::Any;

pub trait Mass : Any {
    fn new(name : &str, location : (f64, f64, f64)) -> Self where Self: Sized;
    fn name(&self) -> &String;
    fn location(&self) -> (f64, f64, f64);
    fn set_location(&mut self, location : (f64, f64, f64));
    fn serialize(&self) -> String;
}

#[derive(Serialize, Deserialize, Debug)]
pub enum Type {
    Ship,
    Astroid,
}

downcast!(Mass);