summaryrefslogtreecommitdiff
path: root/src/server/dashboard.rs
blob: 81ac52277ace8de317b2520054255e8327f087e1 (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 connection::Connection;

impl Connection {
    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,
        }
    }
}