Read the setup file into memory.

This commit is contained in:
Tom Alexander
2023-09-04 16:53:02 -04:00
parent a7330e38e4
commit ee02e07717
4 changed files with 19 additions and 5 deletions

View File

@@ -1,15 +1,14 @@
use std::fmt::Debug;
use std::path::Path;
pub trait FileAccessInterface: Debug {
fn read_file(&self, path: &dyn AsRef<Path>) -> Result<String, Box<dyn std::error::Error>>;
fn read_file(&self, path: &str) -> Result<String, std::io::Error>;
}
#[derive(Debug, Clone)]
pub struct LocalFileAccessInterface;
impl FileAccessInterface for LocalFileAccessInterface {
fn read_file(&self, path: &dyn AsRef<Path>) -> Result<String, Box<dyn std::error::Error>> {
fn read_file(&self, path: &str) -> Result<String, std::io::Error> {
Ok(std::fs::read_to_string(path)?)
}
}