fn read_u8(&mut self) -> Result<u8> {
        if self.show_prompt {
            write!(&mut self.output, "Enter ASCII character: ").chain_err(|| ErrorKind::Io("could not write to output".into()))?;
            self.output.flush().chain_err(|| ErrorKind::Io("could not display prompt".into()))?;
        }

        // We expect one character per line
        let mut input = String::new();
        self.input
            .read_line(&mut input)
            .chain_err(|| ErrorKind::Io("could not read user input".into()))?;
        let tr = input.trim();
        let ch = tr.as_bytes();

        if ch.len() == 1 {
            Ok(ch[0])
        } else {
            Err(ErrorKind::UserInput(format!("expected a single ASCII character; got '{}'", tr))
                .into())
        }
    }
/// Reads a single ASCII character from stdin.
Reads a single ASCII character from stdin.
Reads a single ASCII character from stdin .
fn read_u8(&mut self) -> Result<u8> {
        if self.show_prompt {
            write!(&mut self.output, "Enter ASCII character: ").chain_err(|| ErrorKind::Io("could not write to output".into()))?;
            self.output.flush().chain_err(|| ErrorKind::Io("could not display prompt".into()))?;
        }
        // We expect one character per line
        let mut input = String::new();
        self.input
            .read_line(&mut input)
            .chain_err(|| ErrorKind::Io("could not read user input".into()))?;
        let tr = input.trim();
        let ch = tr.as_bytes();
        if ch.len() == 1 {
            Ok(ch[0])
        } else {
            Err(ErrorKind::UserInput(format!("expected a single ASCII character; got '{}'", tr))
                .into())
        }
    }
fn read_u8 ( & mut self ) -> Result < u8 > { if self . show_prompt { write ! ( mut self output " " ) . chain_err ( | | ErrorKind :: Io ( " " . into ( ) ) ) ? ; self . output . flush ( ) . chain_err ( | | ErrorKind :: Io ( " " . into ( ) ) ) ? ; } // We expect one character per line let mut input = String :: new ( ) ; self . input . read_line ( & mut input ) . chain_err ( | | ErrorKind :: Io ( " " . into ( ) ) ) ? ; let tr = input . trim ( ) ; let ch = tr . as_bytes ( ) ; if ch . len ( ) == 1 { Ok ( ch [ 0 ] ) } else { Err ( ErrorKind :: UserInput ( format ! ( " " tr ) ) . into ( ) ) } }
Reads a single ASCII character from stdin.
Reads a single ASCII character from stdin .
&mut self
&mut self