ask_input β¨οΈ
A micro-library for keyboard input in Rust. No extra code β just input and get values!
π Description
ask_input is a tiny wrapper over Rust's standard I/O. One function. All types. Rust figures out the type automatically.
Features:
- π― One function for everything
- π§ Smart type detection
- β‘ Zero dependencies
βοΈ Installation
ΠΠΎΠ±Π°Π²ΡΡΠ΅ Π² Π²Π°Ρ Cargo.toml:
[]
= "0.2.0"
π§ͺ Examples
Basic usage with proper error handling:
use input;
π¦ Functions
input::<T>()β Input any type (i32, f64, String, etc.)
π Supported Types
| Type | Example | Notes |
|---|---|---|
i32 |
42 |
Leading/trailing whitespace trimmed |
f64 |
3.14 |
Leading/trailing whitespace trimmed |
String |
Hello |
Whitespace preserved (only newline removed) |
bool |
true |
Case-sensitive, whitespace trimmed |
i64, u32... |
Any numeric | Whitespace trimmed |
β οΈ Breaking Changes (v0.1.0 β v0.2.0)
int_input()βinput::<i32>()float_input()βinput::<f64>()str_input()βinput::<String>()- Now returns
Resultinstead of panicking
π€ Author
- FelineFantasy
- License: MIT