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§
Sourcefn bytes(&self, locator: &str) -> Result<Arc<[u8]>, ExtensionError>
fn bytes(&self, locator: &str) -> Result<Arc<[u8]>, ExtensionError>
The bytes registered under locator.
§Errors
ExtensionError::MissingResource when none are registered.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".