Macro read_vec

Source
macro_rules! read_vec {
    ($out:ident as $type:ty) => { ... };
    ($out:ident as String) => { ... };
}
Expand description

Read a line from stdin and parse it to a Vec.

Based on stackoverflow code with addition to read String vec.

§Panics

Panics if the line contains incorrect symbols.

§Examples

use ognlib::read_vec;

// this creates a Vec `x` from the line and parses every number into i32
read_vec!(x as i32);

// this creates a Vec `y` from the line which contains every word
read_vec!(y as String);