Skip to main content

ResourceReader

Trait ResourceReader 

Source
pub trait ResourceReader {
    // Required method
    fn read(&self, path: &Path) -> Result<ResourceData>;
}
Expand description

Supplies image and bibliography bytes at already-resolved source paths.

Each path is read at most once per lowering, including failed reads. Implementors may use memory, archives, or editor overlays; they need no filesystem metadata. The reader is synchronous and need not implement Send or Sync.

Required Methods§

Source

fn read(&self, path: &Path) -> Result<ResourceData>

Read a resolved path, or return the underlying resource error.

§Errors

Return NotFound for absent resources, InvalidInput for paths that do not identify readable resources (such as directories), and an appropriate I/O error for other failures. Lowering preserves the error in its snapshot.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§