use std::{
fs::File,
io::Read,
path::{Path, PathBuf},
};
use error::Error;
#[derive(Debug)]
pub(crate) struct RepoFile(PathBuf);
impl RepoFile {
pub fn new<P: Into<PathBuf>>(path: P) -> Result<RepoFile, Error> {
Ok(RepoFile(path.into()))
}
pub fn path(&self) -> &Path {
self.0.as_ref()
}
pub fn read_to_string(&self) -> Result<String, Error> {
let mut file = File::open(&self.0)?;
let mut string = String::new();
file.read_to_string(&mut string)?;
Ok(string)
}
}