summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authortom barrett <spalf0@gmail.com>2018-02-23 01:10:14 -0600
committertom barrett <spalf0@gmail.com>2018-02-23 01:10:14 -0600
commit7798ebba1d8762e8b4c6eaf1efcd610fa030375a (patch)
treee5d01dfadf6fa8695c29f6ed4ba2a1c727ecd901 /src/bin
parent839f8a7a260276973f41a2c5a6e9d138518d7072 (diff)
-found way to downcast and created new struct
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/client.rs3
-rw-r--r--src/bin/server.rs12
2 files changed, 13 insertions, 2 deletions
diff --git a/src/bin/client.rs b/src/bin/client.rs
index 6f4a8fc..2e8dd45 100644
--- a/src/bin/client.rs
+++ b/src/bin/client.rs
@@ -6,6 +6,7 @@ use std::net::TcpStream;
extern crate space;
use space::dashboard::Dashboard;
use space::engines::Engines;
+use space::navigation::Navigation;
use space::module::{Module, from_primitive};
@@ -46,6 +47,6 @@ fn main() {
match module {
Module::Dashboard => Dashboard(buff_r),
Module::Engines => Engines(stream),
- _ => (),
+ Module::Navigation => Navigation(stream, buff_r),
}
}
diff --git a/src/bin/server.rs b/src/bin/server.rs
index d2923d8..e042855 100644
--- a/src/bin/server.rs
+++ b/src/bin/server.rs
@@ -4,13 +4,23 @@ use std::net::TcpListener;
extern crate space;
use space::mass::Mass;
+use space::astroid::Astroid;
use space::connection::Connection;
+
+fn populate() -> Vec<Box<Mass>> {
+ let mut masses : Vec<Box<Mass>> = Vec::new();
+
+ masses.push(Box::new(Astroid::new("cZfAJ", (10, -5, 4))));
+
+ masses
+}
+
fn main() {
let listener = TcpListener::bind("localhost:6000").unwrap();
listener.set_nonblocking(true).unwrap();
- let mut masses : Vec<Box<Mass>>= Vec::new();
+ let mut masses = populate();
let mut connections = Vec::new();
for stream in listener.incoming() {