From 7798ebba1d8762e8b4c6eaf1efcd610fa030375a Mon Sep 17 00:00:00 2001 From: tom barrett Date: Fri, 23 Feb 2018 01:10:14 -0600 Subject: -found way to downcast and created new struct --- src/bin/client.rs | 3 ++- src/bin/server.rs | 12 +++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'src/bin') 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> { + let mut masses : Vec> = 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>= Vec::new(); + let mut masses = populate(); let mut connections = Vec::new(); for stream in listener.incoming() { -- cgit v1.2.3