pub fn write_response<W: Write, T: Serialize>
    (stream : &mut W, resp : Response, obj : &T) -> Result<(), Error> {
    if let Err(_) = stream.write(&[resp.to_u8()]) {
        return Err(Error::NetworkWriteError)
    }

    write_to_stream::<W, T>(stream, obj)
}
/// This function should be used to write a response of a previous request
/// It is similar to `write_to_stream`, however this function also writes a `Response` byte
/// to indicate whether the request succeeded or not
///
/// Returns a `Result` to simply indicate if the write succeeded
///
/// # Arguments
///
/// * `stream` - The output stream
/// * `resp` - The response code, instance of the enum `Response`
/// * `obj` - The instance of the struct to write
This function should be used to write a response of a previous request
It is similar to `write_to_stream`, however this function also writes a `Response` byte
to indicate whether the request succeeded or not

Returns a `Result` to simply indicate if the write succeeded
This function should be used to write a response of a previous request It is similar to ` write_to_stream ` however this function also writes a ` Response ` byte to indicate whether the request succeeded or not Returns a ` Result ` to simply indicate if the write succeeded
pub fn write_response<W: Write, T: Serialize>
    (stream : &mut W, resp : Response, obj : &T) -> Result<(), Error> {
    if let Err(_) = stream.write(&[resp.to_u8()]) {
        return Err(Error::NetworkWriteError)
    }
    write_to_stream::<W, T>(stream, obj)
}
pub fn write_response < W : Write , T : Serialize > ( stream : & mut W , resp : Response , obj : & T ) -> Result < ( ) , Error > { if let Err ( _ ) = stream . write ( & [ resp . to_u8 ( ) ] ) { return Err ( Error :: NetworkWriteError ) } write_to_stream :: < W , T > ( stream , obj ) }
This function should be used to write a response of a previous request
It is similar to `write_to_stream`, however this function also writes a `Response` byte
to indicate whether the request succeeded or not
This function should be used to write a response of a previous request It is similar to ` write_to_stream ` however this function also writes a ` Response ` byte to indicate whether the request succeeded or not
stream
&mut W
resp
Response
obj
&T
stream
&mut W
resp
Response
obj
&T