summaryrefslogtreecommitdiff
path: root/src/dashboard.rs
diff options
context:
space:
mode:
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,
+ }
+}