summaryrefslogtreecommitdiff
path: root/src/server/dashboard.rs
blob: 91d8831b174c7f1142e114b552a7e50990850e60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
extern crate serde_json;

use std::io::Write;
use std::collections::HashMap;

use mass::Mass;
use server::connection::ServerConnection;

impl ServerConnection {
    pub fn server_dashboard(&mut self, masses : &mut HashMap<String, Mass>) -> bool {
        let ship = masses.get(&self.name).unwrap();
        let send = serde_json::to_string(&ship).unwrap() + "\n";
        match self.stream.write(send.as_bytes()) {
            Ok(_result) => true,
            Err(_error) => false,
        }
    }
}