pub fn encode<W, T>(stream: &mut W, value: T) -> IoResult<Size>where W: Write, T: Into<Value>,
Result: total bytes that have been written.