/// Reads a hexadecimal word from stdin.
Reads a hexadecimal word from stdin.
Reads a hexadecimal word from stdin .
fn read_hex(&mut self) -> Result<u16> {
        // Show a prompt if this feature is enabled
        if self.show_prompt {
            write!(&mut self.output, "Enter hexadecimal word: ").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 hexadecimal word (4 bytes) per line
        let mut input = String::new();
        self.input
            .read_line(&mut input)
            .chain_err(|| ErrorKind::Io("could not read user input".into()))?;
        let hex = input.trim();
        // Validate input
        if hex.len() >= 1 && hex.len() <= 4 {
            Ok(u16::from_str_radix(hex, 16).chain_err(|| {
                    ErrorKind::UserInput(format!("'{}' is not a valid hexadecimal word", hex))
                })?)
        } else {
            Err(ErrorKind::UserInput(format!("'{}' is not a valid hexadecimal word (should be \
                                              at most 4 hexadecimal digits)",
                                             hex))
                .into())
        }
    }
fn read_hex ( & mut self ) -> Result < u16 > { // Show a prompt if this feature is enabled if self . show_prompt { write ! ( mut self output " " ) . chain_err ( | | ErrorKind :: Io ( " " . into ( ) ) ) ? ; self . output . flush ( ) . chain_err ( | | ErrorKind :: Io ( " " . into ( ) ) ) ? ; } // We expect one hexadecimal word (4 bytes) per line let mut input = String :: new ( ) ; self . input . read_line ( & mut input ) . chain_err ( | | ErrorKind :: Io ( " " . into ( ) ) ) ? ; let hex = input . trim ( ) ; // Validate input if hex . len ( ) >= 1 && hex . len ( ) <= 4 { Ok ( u16 :: from_str_radix ( hex , 16 ) . chain_err ( | | { ErrorKind :: UserInput ( format ! ( " " hex ) ) } ) ? ) } else { Err ( ErrorKind :: UserInput ( format ! ( " \
 " hex ) ) . into ( ) ) } }
Reads a hexadecimal word from stdin.
Reads a hexadecimal word from stdin .
&mut self