Read the setup file into memory.
This commit is contained in:
@@ -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)?)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user