Function read_input_from

Source
pub fn read_input_from<R, T>(
    reader: &mut R,
    prompt: Option<Arguments<'_>>,
) -> Result<T, InputError<T::Err>>
where R: BufRead, T: FromStr, T::Err: Display + Debug,
Expand description

A single function that:

  1. Optionally prints a prompt (and flushes).
  2. Reads one line from the provided BufRead.
  3. Returns Err(InputError::Eof) if EOF is reached.
  4. Parses into type T, returning Err(InputError::Parse) on failure.
  5. Returns Err(InputError::Io) on I/O failure.