Crates.io | input_simplified |
lib.rs | input_simplified |
version | 0.0.3 |
source | src |
created_at | 2024-07-01 04:44:43.004857 |
updated_at | 2024-07-01 06:39:16.981317 |
description | A simple input handling crate |
homepage | |
repository | https://github.com/ananduremanan/input_simplified |
max_upload_size | |
id | 1288382 |
size | 4,043 |
A simple input handling crate for Rust.
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);
}