Skip to main content

RenderBackend

Trait RenderBackend 

Source
pub trait RenderBackend: Send {
    // Required methods
    fn name(&self) -> &'static str;
    fn version(&self) -> &'static str;
    fn open(
        &self,
        source: Arc<dyn ByteSource>,
        options: &RenderOpenOptions,
    ) -> Result<Box<dyn RenderDocument>, RenderError>;
}
Expand description

A rendering engine: opens documents. Object-safe, so shells hold Box<dyn RenderBackend>.

A renderer only produces pixels: text, glyph quads, structure, annotation and form geometry, links and outlines always come from Lamina PDF’s model, never from the renderer (ADR 0004 §1).

Added in 0.2.0.

Required Methods§

Source

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

"pdfium" or "hayro"; with RenderBackend::version, part of every golden’s key.

Added in 0.2.0.

Source

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

The engine’s version (a crate version or a PDFium build tag).

Added in 0.2.0.

Source

fn open( &self, source: Arc<dyn ByteSource>, options: &RenderOpenOptions, ) -> Result<Box<dyn RenderDocument>, RenderError>

Opens a document from source (the same source Lamina PDF reads, never a second copy).

§Errors

password-required, wrong-password, data-pending (with the ranges to fetch), source, render-failed (the engine can’t open the file), render-backend-unavailable.

Added in 0.2.0.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§