diff options
author | tom barrett <spalf0@gmail.com> | 2018-02-26 08:51:08 -0600 |
---|---|---|
committer | tom barrett <spalf0@gmail.com> | 2018-02-26 08:51:08 -0600 |
commit | c14dcf1998f5ba1ffea813da4f793fc3bde8c2b7 (patch) | |
tree | f650e9bdf008a785b4627db04446c717f530e7c5 /src/ship.rs | |
parent | 6634f73a6768f61f928d51941be5e970e6011f07 (diff) |
-figured out way to deserialize using serde_erased
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(); - } } |