use std::fmt::Debug; use std::path::PathBuf; #[cfg(any(feature = "compare", feature = "foreign_document_test"))] pub trait FileAccessInterface: Sync + Debug { fn read_file(&self, path: &str) -> Result; } #[cfg(not(any(feature = "compare", feature = "foreign_document_test")))] pub trait FileAccessInterface: Debug { fn read_file(&self, path: &str) -> Result; } #[derive(Debug, Clone)] pub struct LocalFileAccessInterface { pub working_directory: Option, } impl FileAccessInterface for LocalFileAccessInterface { fn read_file(&self, path: &str) -> Result { let final_path = self .working_directory .as_deref() .map(|pb| pb.join(path)) .unwrap_or_else(|| PathBuf::from(path)); std::fs::read_to_string(final_path) } }