14 lines
395 B
Rust
14 lines
395 B
Rust
![]() |
use std::path::Path;
|
||
|
|
||
|
pub trait FileAccessInterface {
|
||
|
fn read_file<P: AsRef<Path>>(&self, path: P) -> Result<String, Box<dyn std::error::Error>>;
|
||
|
}
|
||
|
|
||
|
pub struct LocalFileAccessInterface;
|
||
|
|
||
|
impl FileAccessInterface for LocalFileAccessInterface {
|
||
|
fn read_file<P: AsRef<Path>>(&self, path: P) -> Result<String, Box<dyn std::error::Error>> {
|
||
|
Ok(std::fs::read_to_string(path)?)
|
||
|
}
|
||
|
}
|