input_simplified 0.0.3

A simple input handling crate
Documentation
  • Coverage
  • 0%
    0 out of 6 items documented0 out of 5 items with examples
  • Size
  • Source code size: 3.73 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 258.74 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • ananduremanan/input_simplified
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • ananduremanan

input_simplified

A simple input handling crate for Rust.

Usage

Add this to your Cargo.toml:

[dependencies]
input_simplified = "0.0.3"
use input_simplified::input;

fn main() {
    let name: String = input()
        .message("Enter your name: ")
        .get_input()
        .expect("Not a valid input");
    println!("Hello, {}!", name);

    let age: i32 = input()
        .message("Enter your age: ")
        .get_input()
        .expect("Not a valid input");
    println!("You are {} years old.", age);

    let height: f64 = input()
        .message("Enter your height in meters: ")
        .get_input()
        .expect("Not a valid input");
    println!("You are {} meters tall.", height);
}