Skip to main content

Renderer

Trait Renderer 

Source
pub trait Renderer: Send + Sync {
    // Required methods
    fn validate(&self, request: &RenderRequest) -> Result<RendererValidation>;
    fn render(&self, request: &RenderRequest) -> Result<RenderedDocument>;

    // Provided method
    fn render_cancellable(
        &self,
        request: &RenderRequest,
        cancellation: &CancellationToken,
    ) -> Result<RenderedDocument> { ... }
}
Expand description

Object-safe boundary implemented by native, future WASM, or alternate backends.

Required Methods§

Source

fn validate(&self, request: &RenderRequest) -> Result<RendererValidation>

Parse and validate without producing artifacts.

Source

fn render(&self, request: &RenderRequest) -> Result<RenderedDocument>

Validate, compose, and return requested artifacts in memory.

Provided Methods§

Source

fn render_cancellable( &self, request: &RenderRequest, cancellation: &CancellationToken, ) -> Result<RenderedDocument>

Renders while checking a cooperative cancellation signal.

Implementations that do not override this method are cancellable before and after their render call. NativeRenderer also checks between inspection, composition, DOCX writing, and PDF rendering.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§