diff options
Diffstat (limited to 'src/ship.rs')
-rw-r--r-- | src/ship.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/ship.rs b/src/ship.rs index e5186c8..078c2c1 100644 --- a/src/ship.rs +++ b/src/ship.rs @@ -1,10 +1,11 @@ -use mass::Mass; +use mass::{Mass, Type}; extern crate serde_json; #[derive(Serialize, Deserialize, Debug)] pub struct Ship { name : String, location : (f64, f64, f64), + t : Type, r : f64, } @@ -19,6 +20,7 @@ impl Mass for Ship { Ship { name : String::from(name), location : location, + t : Type::Ship, r : 100.0, } } @@ -35,11 +37,7 @@ impl Mass for Ship { self.location = location; } - fn serialize(&self) ->String { + fn serialize(&self) -> String { serde_json::to_string(self).unwrap() } - - fn deserialize(&mut self, data : &str) { - //self = serde_json::from_str(data).unwrap(); - } } |