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

Supplies bytes a source needs besides its own (sequence frames, SVG fonts and images). Parsers may call it from other threads, hence Send + Sync.

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§