Use serde in devtools

This commit is contained in:
Anthony Ramine 2016-03-30 15:52:06 +02:00
parent 77444d00be
commit 406273c641
23 changed files with 245 additions and 233 deletions

View file

@ -5,10 +5,10 @@
/// General actor system infrastructure.
use devtools_traits::PreciseTime;
use rustc_serialize::json;
use serde_json::Value;
use std::any::Any;
use std::cell::{Cell, RefCell};
use std::collections::HashMap;
use std::collections::{BTreeMap, HashMap};
use std::mem::replace;
use std::net::TcpStream;
use std::sync::{Arc, Mutex};
@ -26,7 +26,7 @@ pub trait Actor: Any + ActorAsAny {
fn handle_message(&self,
registry: &ActorRegistry,
msg_type: &str,
msg: &json::Object,
msg: &BTreeMap<String, Value>,
stream: &mut TcpStream) -> Result<ActorMessageStatus, ()>;
fn name(&self) -> String;
}
@ -150,7 +150,7 @@ impl ActorRegistry {
/// Attempt to process a message as directed by its `to` property. If the actor is not
/// found or does not indicate that it knew how to process the message, ignore the failure.
pub fn handle_message(&mut self,
msg: &json::Object,
msg: &BTreeMap<String, Value>,
stream: &mut TcpStream)
-> Result<(), ()> {
let to = msg.get("to").unwrap().as_string().unwrap();