Skip to content

New API for easier value reading from stdin #1142

@dFionov

Description

@dFionov

Today reading value from stdin look like:

let a: i32 = stdin.lock().lines().next().unwrap().unwrap().trim().parse().unwrap();

As i think, Rust needs easier way to do this. E. g. like:

let a = stdin.read::<i32>().ok().expect("Write a number!");
let (b, c, d) = stdin.read::<(i32, f64, bool)>.ok().expect("Please, write integer, float and boolean!");

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions