blob: 800ef585d7c6c374af41f6b3e7a4483a555522c5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
use downcast::Any;
pub trait Mass : Any {
fn name(&self) -> &String;
fn position(&self) -> (f64, f64, f64);
fn serialize(&self) -> String;
fn process(&mut self);
fn give_acceleration(&mut self, acceleration : (f64, f64, f64));
fn recv_velocity(&self) -> (f64, f64, f64);
fn box_clone(&self) -> Box<Mass>;
}
impl Clone for Box<Mass> {
fn clone(&self) -> Box<Mass> {
self.box_clone()
}
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub enum Type {
Ship,
Astroid,
}
downcast!(Mass);
|