urs 0.5.1

Rust utility library
Documentation
//! # io
//!
//! I/O utilities

pub use std::io::prelude::*;
use std::io::{self, BufReader};

pub trait ReadExtra
where
    Self: Read,
{
    /// Wrapper to `read_line`,
    /// trims the output and doesn't need a string reference
    fn read_line_trim(&mut self) -> Result<String, io::Error> {
        let mut buf = String::new();
        let mut reader = BufReader::new(self);
        reader.read_line(&mut buf)?;
        Ok(buf.trim().to_owned())
    }

    /// Wrapper around `read_to_string`, doesn't require input
    fn read_everything(&mut self) -> Result<String, io::Error> {
        let mut buf = String::new();
        self.read_to_string(&mut buf)?;
        Ok(buf)
    }
}

impl<T: Read> ReadExtra for T {}