diff options
Diffstat (limited to 'src/astroid.rs')
-rw-r--r-- | src/astroid.rs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/astroid.rs b/src/astroid.rs new file mode 100644 index 0000000..dd47123 --- /dev/null +++ b/src/astroid.rs @@ -0,0 +1,33 @@ +use mass::Mass; +extern crate serde_json; + +#[derive(Serialize, Deserialize, Debug)] +pub struct Astroid { + name : String, + location : (isize, isize, isize), +} + +impl Mass for Astroid { + fn new(name : &str, location : (isize, isize, isize)) -> Astroid { + Astroid { + name : String::from(name), + location : location, + } + } + + fn name(&self) -> &String { + &self.name + } + + fn location(&self) -> (isize, isize, isize) { + self.location + } + + fn set_location(&mut self, location : (isize, isize, isize)) { + self.location = location; + } + + fn serialize(&self) ->String { + serde_json::to_string(self).unwrap() + } +} |