# ask_input β¨οΈ
[](https://www.rust-lang.org/)
[](LICENSE)
[](https://docs.rs/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`:
```toml
[dependencies]
ask_input = "0.2.0"
```
## π§ͺ Examples
Basic usage with proper error handling:
```rust
use ask_input::input;
fn main() {
let age: i32 = input().expect("Failed to read age");
let price: f64 = input().expect("Failed to read price");
let name: String = input().expect("Failed to read name");
println!("Age: {}, Price: {}, Name: {}", age, price, name);
}
```
## π¦ Functions
- `input::<T>()` β Input any type (i32, f64, String, etc.)
## π Supported Types
| `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 `Result` instead of panicking
## π€ Author
- **FelineFantasy**
- **License**: MIT