Expand description
Crate for reading whitespace-separated values.
The crate defines a trait FromStream, which
describes types that can be parsed from whitespace-separated words,
which includes eg. integers, tuples, vectors and various adapters.
The definition of whitespace used in this crate is described in
SplitAsciiWhitespace.
§Examples
Basics
let (s, i): (String, i32) = parse_string(" answer 42 ").unwrap();Easy reading from stdin.
let x: i32 = parse_line().unwrap();Efficient reading from stdin (newline-agnostic) with Reader.
let mut i = Reader::from_stdin_naive();
while let Some(f) = i.parse::<Option<f64>>()? {
println!("{}", f);
}Re-exports§
pub use self::stream::FromStream;pub use self::reader::Reader;
Modules§
- adapters
- This module defines adapters for
FromStreamtrait. - reader
- This module defines the
Readerstruct. - stream
- This module defines the
StrStreamandFromStreamtraits
Functions§
- parse_
file - Parses a whole file as a
FromStreamvalue - parse_
line - Parse
FromStreamvalue from one line of stdin. - parse_
stdin - Parse the whole stdin as a
FromStreamvalue - parse_
string - Parse
FromStreamvalue from string.