Skip to main content

AsyncFileIO

Trait AsyncFileIO 

Source
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§

Source

fn read_sync(&self, path: &Path) -> Result<Vec<u8>>

Read an entire file.

Source

fn write_sync(&self, path: &Path, data: &[u8]) -> Result<()>

Write an entire file, creating parent directories when needed.

Source

fn read_batch_sync(&self, paths: &[&Path]) -> Result<Vec<Result<Vec<u8>>>>

Read several files and preserve per-file errors.

Source

fn write_batch_sync(&self, files: &[(&Path, &[u8])]) -> Result<Vec<Result<()>>>

Write several files and preserve per-file errors.

Source

fn backend_name(&self) -> &'static str

Return the backend name used for diagnostics and tests.

Source

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".

Implementors§