pub fn read_command<R : Read, T: for<'de> Deserialize<'de>>
    (stream : &mut R) -> Result<(u8, T), Error> {
    let mut code = [0u8; 1];
    if let Err(_) = stream.read_exact(&mut code) {
        return Err(Error::NetworkReadError);
    }

    match read_from_stream::<R, T>(stream) {
            Ok(r)   => Ok((code[0], r)),
            Err(e)  => Err(e)
    }
}
/// This function reads a command from input stream
/// Similar to read_from_stream, but before the JSON object it attempts to read a byte
/// indicating the command code, which has to be managed outside of this library
///
/// Returns a `Result` wrapping a tuple containing the command code and the `T` instance
///
/// # Arguments
///
/// * `stream` - The input stream
This function reads a command from input stream
Similar to read_from_stream, but before the JSON object it attempts to read a byte
indicating the command code, which has to be managed outside of this library

Returns a `Result` wrapping a tuple containing the command code and the `T` instance
This function reads a command from input stream Similar to read_from_stream but before the JSON object it attempts to read a byte indicating the command code which has to be managed outside of this library Returns a ` Result ` wrapping a tuple containing the command code and the ` T ` instance
pub fn read_command<R : Read, T: for<'de> Deserialize<'de>>
    (stream : &mut R) -> Result<(u8, T), Error> {
    let mut code = [0u8; 1];
    if let Err(_) = stream.read_exact(&mut code) {
        return Err(Error::NetworkReadError);
    }
    match read_from_stream::<R, T>(stream) {
            Ok(r)   => Ok((code[0], r)),
            Err(e)  => Err(e)
    }
}
pub fn read_command < R : Read , T : for < ' de > Deserialize < ' de > > ( stream : & mut R ) -> Result < ( u8 , T ) , Error > { let mut code = [ 0u8 ; 1 ] ; if let Err ( _ ) = stream . read_exact ( & mut code ) { return Err ( Error :: NetworkReadError ) ; } match read_from_stream :: < R , T > ( stream ) { Ok ( r ) => Ok ( ( code [ 0 ] , r ) ) , Err ( e ) => Err ( e ) } }
This function reads a command from input stream
Similar to read_from_stream, but before the JSON object it attempts to read a byte
indicating the command code, which has to be managed outside of this library
This function reads a command from input stream Similar to read_from_stream but before the JSON object it attempts to read a byte indicating the command code which has to be managed outside of this library
stream
&mut R
stream
&mut R