pub trait AsyncFileIO: Send + Sync {
// Required methods
fn read_sync(&self, path: &Path) -> Result<Vec<u8>>;
fn write_sync(&self, path: &Path, data: &[u8]) -> Result<()>;
fn read_batch_sync(&self, paths: &[&Path]) -> Result<Vec<Result<Vec<u8>>>>;
fn write_batch_sync(
&self,
files: &[(&Path, &[u8])],
) -> Result<Vec<Result<()>>>;
fn backend_name(&self) -> &'static str;
fn is_available(&self) -> bool;
}Expand description
Unified file I/O trait used by machine-format optimization helpers.
Implementations may use blocking or platform-specific I/O internally, but the exposed contract remains synchronous for deterministic serializer flows.
Required Methods§
Sourcefn write_sync(&self, path: &Path, data: &[u8]) -> Result<()>
fn write_sync(&self, path: &Path, data: &[u8]) -> Result<()>
Write an entire file, creating parent directories when needed.
Sourcefn read_batch_sync(&self, paths: &[&Path]) -> Result<Vec<Result<Vec<u8>>>>
fn read_batch_sync(&self, paths: &[&Path]) -> Result<Vec<Result<Vec<u8>>>>
Read several files and preserve per-file errors.
Sourcefn write_batch_sync(&self, files: &[(&Path, &[u8])]) -> Result<Vec<Result<()>>>
fn write_batch_sync(&self, files: &[(&Path, &[u8])]) -> Result<Vec<Result<()>>>
Write several files and preserve per-file errors.
Sourcefn backend_name(&self) -> &'static str
fn backend_name(&self) -> &'static str
Return the backend name used for diagnostics and tests.
Sourcefn is_available(&self) -> bool
fn is_available(&self) -> bool
Return whether the backend is available on this platform.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".