/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//! Low-level wire protocol implementation. Currently only supports
//! [JSON packets]
//! (https://wiki.mozilla.org/Remote_Debugging_Protocol_Stream_Transport#JSON_Packets).
use rustc_serialize::json::Json;
use rustc_serialize::json::ParserError::{IoError, SyntaxError};
use rustc_serialize::{Encodable, json};
use std::error::Error;
use std::io::{Read, Write};
use std::net::TcpStream;
pub trait JsonPacketStream {
fn write_json_packet<'a, T: Encodable>(&mut self, obj: &T);
fn read_json_packet(&mut self) -> Result