Skip to main content

DocumentExt

Trait DocumentExt 

Source
pub trait DocumentExt {
    // Required methods
    fn render(&self) -> Result<Vec<u8>, RenderError>;
    fn render_with_diagnostics(
        &self,
    ) -> Result<(Vec<u8>, Vec<LayoutWarning>), RenderError>;
    fn render_with_fonts(
        &self,
        fonts: &FontRegistry,
    ) -> Result<Vec<u8>, RenderError>;
    fn render_with_fonts_and_diagnostics(
        &self,
        fonts: &FontRegistry,
    ) -> Result<(Vec<u8>, Vec<LayoutWarning>), RenderError>;
}
Expand description

Extension trait adding render()/render_with_diagnostics() (bundled default fonts) and render_with_fonts()/render_with_fonts_and_diagnostics() (caller-supplied fonts, see fonts.rs::FontRegistry::with_fonts()) to lightweight_pdf_core::Document. Lives here (not in lightweight-pdf-core) because rendering needs layout, fonts and the PDF writer — lightweight-pdf-core must not depend on any of them (ADR-002). This is the point at which render() becomes public (ADR-002).

Required Methods§

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§