# rsio
---
## English
A simple Rust IO helper library for console input.
### Installation
Add to your `Cargo.toml`:
```toml
[dependencies]
rsio = "0.1.0"
```
### Usage
```rust
use rsio::{input, input_num};
fn main() {
// Read a string from stdin
let name = input();
println!("Hello, {}", name);
// Read a number from stdin (supports any FromStr type)
let x: i32 = input_num();
let y: f64 = input_num();
println!("x + y = {}", x as f64 + y);
}
```
### API
- **`input() -> String`** — Reads a line from stdin, trims whitespace, and returns it as a `String`.
- **`input_num<F: FromStr>() -> F`** — Reads a line from stdin and parses it into the specified numeric type.
### License
MIT
---
## 中文
一个简单的 Rust 控制台输入辅助库。
### 安装
在 `Cargo.toml` 中添加:
```toml
[dependencies]
rsio = "0.1.0"
```
### 使用
```rust
use rsio::{input, input_num};
fn main() {
// 从标准输入读取字符串
let name = input();
println!("你好, {}", name);
// 从标准输入读取数字(支持任意实现了 FromStr 的类型)
let x: i32 = input_num();
let y: f64 = input_num();
println!("x + y = {}", x as f64 + y);
}
```
### API
- **`input() -> String`** — 从标准输入读取一行,去除首尾空白后返回 `String`。
- **`input_num<F: FromStr>() -> F`** — 从标准输入读取一行并解析为指定数字类型。
### 许可协议
MIT