typstgen 0.1.0

Compile existing .typ files to PDF with an embedded Typst engine — no external typst binary, config-driven template resolution. Usable as CLI, Rust lib, and Wasm.
Documentation
use std::path::PathBuf;

#[derive(Debug, thiserror::Error)]
pub enum Error {
    #[error("input file not found: {0}")]
    InputNotFound(PathBuf),

    #[error("no template path configured or found for import resolution")]
    TemplatePathNotFound,

    #[error("failed to read config at {path}: {source}")]
    Config {
        path: PathBuf,
        #[source]
        source: std::io::Error,
    },

    #[error("invalid config: {0}")]
    InvalidConfig(#[from] toml::de::Error),

    #[error("typst compilation failed:\n{0}")]
    Compile(String),

    #[error(transparent)]
    Io(#[from] std::io::Error),
}

pub type Result<T> = std::result::Result<T, Error>;