Skip to main content

quillmark_core/
backend.rs

1//! Backend trait for output backends.
2
3use crate::error::RenderError;
4use crate::quill::QuillSource;
5use crate::{OutputFormat, RenderSession};
6
7/// Backend trait for rendering different output formats.
8pub trait Backend: Send + Sync + std::fmt::Debug {
9    /// Get the backend identifier (e.g., "typst", "latex").
10    fn id(&self) -> &'static str;
11
12    /// Get supported output formats.
13    fn supported_formats(&self) -> &'static [OutputFormat];
14
15    /// Open an iterative render session from plate + compiled JSON data.
16    fn open(
17        &self,
18        plate_content: &str,
19        source: &QuillSource,
20        json_data: &serde_json::Value,
21    ) -> Result<RenderSession, RenderError>;
22}