Crates.io | ascii-read |
lib.rs | ascii-read |
version | 0.1.0 |
source | src |
created_at | 2022-12-06 02:50:43.598929 |
updated_at | 2022-12-06 02:50:43.598929 |
description | `BufRead`-like methods for reading into an `AsciiString`. |
homepage | |
repository | https://github.com/mdsn/ascii-read |
max_upload_size | |
id | 730813 |
size | 9,808 |
This library provides a trait with read_ascii_lines()
and read_ascii_line()
methods, parallel to those of BufRead
, that return ascii::AsciiString
.
[dependencies]
ascii-read = "0.1.0"
Run this example with cargo run --example ascii_lines
.
use ascii_read::AsciiBufRead;
use std::error::Error;
use std::io;
fn main() -> Result<(), Box<dyn Error>> {
let handle = io::stdin().lock();
let mut lines = vec![];
for line in handle.ascii_lines() {
lines.push(line?);
}
println!("* Input provided:");
for line in lines {
println!("{line}");
}
Ok(())
}
This library depends on the ascii
and thiserror
crates.
Licensed under MIT license.