Enum scan::ScanError [] [src]

pub enum ScanError<F: FromStr> {
    Parse(F::Err),
    Io(CharsError),
    EndOfFile,
}

Enum representing an error which can arise when extracting an F from a readable stream.

Examples

let mut scanner = from_stdin();
let result = scanner.next::<i32>();
match result {
    Err(ScanError::Parse(e)) => println!("Could not parse! Error: {}", e),
    Err(ScanError::Io(e)) => println!("I/O related error: {}", e),
    Err(ScanError::EndOfFile) => println!("No more input to read!"),
    Ok(v) => println!("Integer scanned: {}", v),
}

Variants

A string was tokenized but could not be parsed

An I/O error occured, including a potential UTF-8 error

No input left to tokenize

Trait Implementations

impl<F: Debug + FromStr> Debug for ScanError<F> where
    F::Err: Debug
[src]

Formats the value using the given formatter.

impl<F> Display for ScanError<F> where
    F: FromStr + Debug,
    <F as FromStr>::Err: Error
[src]

Formats the value using the given formatter. Read more

impl<F: FromStr> From<CharsError> for ScanError<F>
[src]

Performs the conversion.

impl<F: FromStr> From<Error> for ScanError<F>
[src]

Performs the conversion.

impl<F> Error for ScanError<F> where
    F: FromStr + Debug,
    <F as FromStr>::Err: Error + Any
[src]

A short description of the error. Read more

The lower-level cause of this error, if any. Read more