diff options
author | tom barrett <spalf0@gmail.com> | 2018-02-23 01:10:14 -0600 |
---|---|---|
committer | tom barrett <spalf0@gmail.com> | 2018-02-23 01:10:14 -0600 |
commit | 7798ebba1d8762e8b4c6eaf1efcd610fa030375a (patch) | |
tree | e5d01dfadf6fa8695c29f6ed4ba2a1c727ecd901 /src/mass.rs | |
parent | 839f8a7a260276973f41a2c5a6e9d138518d7072 (diff) |
-found way to downcast and created new struct
Diffstat (limited to 'src/mass.rs')
-rw-r--r-- | src/mass.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/mass.rs b/src/mass.rs index d1f9d3e..955f84d 100644 --- a/src/mass.rs +++ b/src/mass.rs @@ -1,7 +1,11 @@ -pub trait Mass { +use downcast::Any; + +pub trait Mass : Any { fn new(name : &str, location : (isize, isize, isize)) -> Self where Self: Sized; - fn get_name(&self) -> &String; - fn get_location(&self) -> (isize, isize, isize); - fn give_location(&mut self, location : (isize, isize, isize)); + fn name(&self) -> &String; + fn location(&self) -> (isize, isize, isize); + fn set_location(&mut self, location : (isize, isize, isize)); fn serialize(&self) -> String; } + +downcast!(Mass); |