summaryrefslogtreecommitdiff
path: root/src/dashboard.rs
diff options
context:
space:
mode:
authortom barrett <spalf0@gmail.com>2018-02-28 06:33:25 -0600
committertom barrett <spalf0@gmail.com>2018-02-28 06:33:25 -0600
commit1edbee505f2f026ab78603fcb0a38f3acbd0dad1 (patch)
tree70d9d82204a07dfb60b64a777e42c757b3c08cf8 /src/dashboard.rs
parentb9c6f63bc6172dfa48a171711a746637b0d5a4c2 (diff)
-moved server modules into their respecive modules
Diffstat (limited to 'src/dashboard.rs')
-rw-r--r--src/dashboard.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/dashboard.rs b/src/dashboard.rs
index 2227251..99d5331 100644
--- a/src/dashboard.rs
+++ b/src/dashboard.rs
@@ -1,12 +1,14 @@
use std::io::BufReader;
use std::io::BufRead;
use std::net::TcpStream;
+use std::io::Write;
extern crate serde_json;
use ship::Ship;
+use mass::Mass;
-pub fn Dashboard(mut buff_r : BufReader<TcpStream>) {
+pub fn client_dashboard(mut buff_r : BufReader<TcpStream>) {
loop {
let mut data = String::new();
buff_r.read_line(&mut data).unwrap();
@@ -14,3 +16,11 @@ pub fn Dashboard(mut buff_r : BufReader<TcpStream>) {
println!("{:?}", ship);
}
}
+
+pub fn server_dashboard(mut ship_string : String, mut stream : &TcpStream) -> bool {
+ ship_string.push_str("\n");
+ match stream.write(ship_string.as_bytes()) {
+ Ok(_result) => true,
+ Err(_error) => false,
+ }
+}