Skip to main content

ResourceResolver

Trait ResourceResolver 

Source
pub trait ResourceResolver: Send + Sync {
    // Required method
    fn bytes(&self, locator: &str) -> Result<Arc<[u8]>, ExtensionError>;

    // Provided method
    fn fonts(&self) -> Vec<Arc<[u8]>> { ... }
}
Expand description

Bytes a source needs besides its own: an image sequence’s frames, and the fonts and images an SVG names. A provider never fetches anything else. It may be asked from inside a parser (usvg asks for each image it draws), which requires it to be shared across threads.

Required Methods§

Source

fn bytes(&self, locator: &str) -> Result<Arc<[u8]>, ExtensionError>

The bytes registered under locator.

§Errors

ExtensionError::MissingResource when none are registered.

Provided Methods§

Source

fn fonts(&self) -> Vec<Arc<[u8]>>

Every registered font file, for documents that draw text.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§