pub trait ReadOperations: Send + Sync {
// Required methods
fn read_file(&self, absolute_path: &Path) -> Result<Vec<u8>>;
fn file_size(&self, absolute_path: &Path) -> Result<u64>;
fn detect_image_mime(
&self,
absolute_path: &Path,
) -> Result<Option<&'static str>>;
fn read_text_file(&self, absolute_path: &Path) -> Result<String>;
}Expand description
Pluggable operations for the read tool (matching pi’s ReadOperations). Override these to delegate file reading to remote systems (for example SSH).
Required Methods§
Sourcefn detect_image_mime(
&self,
absolute_path: &Path,
) -> Result<Option<&'static str>>
fn detect_image_mime( &self, absolute_path: &Path, ) -> Result<Option<&'static str>>
Detect image MIME type from magic bytes. Returns None for non-images.
Sourcefn read_text_file(&self, absolute_path: &Path) -> Result<String>
fn read_text_file(&self, absolute_path: &Path) -> Result<String>
Read entire file as a UTF-8 string.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".