mdsn / ascii-read

Methods to read AsciiString from BufReader instances.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ascii-read

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"

Example

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(())
}

Dependencies

This library depends on the ascii and thiserror crates.

License

Licensed under MIT license.

About

Methods to read AsciiString from BufReader instances.

License:MIT License


Languages

Language:Rust 100.0%