organic/src/context/file_access_interface.rs

15 lines
376 B
Rust
Raw Normal View History

use std::fmt::Debug;
pub trait FileAccessInterface: Debug {
2023-09-04 16:53:02 -04:00
fn read_file(&self, path: &str) -> Result<String, std::io::Error>;
}
#[derive(Debug, Clone)]
pub struct LocalFileAccessInterface;
impl FileAccessInterface for LocalFileAccessInterface {
2023-09-04 16:53:02 -04:00
fn read_file(&self, path: &str) -> Result<String, std::io::Error> {
Ok(std::fs::read_to_string(path)?)
}
}