diff options
author | tom barrett <spalf0@gmail.com> | 2018-04-12 04:33:23 -0500 |
---|---|---|
committer | tom barrett <spalf0@gmail.com> | 2018-04-12 04:33:23 -0500 |
commit | 573ba69d810914c153a578747414b3d631e61bbc (patch) | |
tree | 4ce164db9d28ede9778d75ddb4f6922ea1dc1a91 /src/dashboard.rs | |
parent | ab797e7f30e5e8913faf73516346129b9a620550 (diff) |
completely restructured code and fixed navigation bug
Diffstat (limited to 'src/dashboard.rs')
-rw-r--r-- | src/dashboard.rs | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/src/dashboard.rs b/src/dashboard.rs deleted file mode 100644 index 663818a..0000000 --- a/src/dashboard.rs +++ /dev/null @@ -1,31 +0,0 @@ -use std::io::BufReader; -use std::io::BufRead; -use std::net::TcpStream; -use std::io::Write; -use std::collections::HashMap; - -extern crate serde_json; - -use mass::Mass; -use ship::Ship; -use connection::Connection; - -pub fn client_dashboard(mut buff_r : BufReader<TcpStream>) { - loop { - let mut recv = String::new(); - buff_r.read_line(&mut recv).unwrap(); - let ship : Ship = serde_json::from_str(&recv).unwrap(); - println!("{:?}", ship); - } -} - -impl Connection { - pub fn server_dashboard(&mut self, masses : &mut HashMap<String, Box<Mass>>) -> bool { - let ship = masses.get(&self.name).unwrap(); - let send = ship.serialize() + "\n"; - match self.stream.write(send.as_bytes()) { - Ok(_result) => true, - Err(_error) => false, - } - } -} |