fn send(stream: &mut TcpStream, command: Command) -> std::io::Result<()> {
    let command = [command as u8];
    stream.write_all(&command)?;
    let mut rcv = [0; 1];
    stream.read_exact(&mut rcv)?;
    match rcv {
        _ if rcv == command => Ok(()),
        _ => Err(std::io::Error::new(
            std::io::ErrorKind::Other,
            "Unexpected reply.",
        )),
    }
}
/// Send the `command` to the server and handle the return value.
Send the `command` to the server and handle the return value.
Send the ` command ` to the server and handle the return value .
fn send(stream: &mut TcpStream, command: Command) -> std::io::Result<()> {
    let command = [command as u8];
    stream.write_all(&command)?;
    let mut rcv = [0; 1];
    stream.read_exact(&mut rcv)?;
    match rcv {
        _ if rcv == command => Ok(()),
        _ => Err(std::io::Error::new(
            std::io::ErrorKind::Other,
            "Unexpected reply.",
        )),
    }
}
fn send ( stream : & mut TcpStream , command : Command ) -> std :: io :: Result < ( ) > { let command = [ command as u8 ] ; stream . write_all ( & command ) ? ; let mut rcv = [ 0 ; 1 ] ; stream . read_exact ( & mut rcv ) ? ; match rcv { _ if rcv == command => Ok ( ( ) ) , _ => Err ( std :: io :: Error :: new ( std :: io :: ErrorKind :: Other , " " , ) ) , } }
Send the `command` to the server and handle the return value.
Send the ` command ` to the server and handle the return value .
stream
&mut TcpStream
command
Command
stream
&mut TcpStream
command
Command