Distinguish between format and output kind

This commit is contained in:
Patrick Förster 2019-11-25 17:25:32 +01:00
parent 6919c4ee29
commit 3064fb6531
6 changed files with 23 additions and 5 deletions

View file

@ -26,6 +26,12 @@ impl Format {
}
}
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum OutputKind {
Dvi,
Pdf,
}
#[derive(Debug)]
pub struct CompileResult {
pub log: String,

View file

@ -53,6 +53,13 @@ pub trait Distribution: Send + Sync {
fn supports_format(&self, format: Format) -> bool;
fn output_kind(&self, format: Format) -> OutputKind {
match format {
Format::Latex => OutputKind::Dvi,
Format::Pdflatex | Format::Xelatex | Format::Lualatex => OutputKind::Pdf,
}
}
#[boxed]
async fn compile<'a>(
&'a self,

View file

@ -12,11 +12,15 @@ impl Distribution for Tectonic {
fn supports_format(&self, format: Format) -> bool {
match format {
Format::Latex | Format::Lualatex => false,
Format::Pdflatex | Format::Xelatex => true,
Format::Latex | Format::Pdflatex | Format::Xelatex => true,
Format::Lualatex => false,
}
}
fn output_kind(&self, _format: Format) -> OutputKind {
OutputKind::Pdf
}
#[boxed]
async fn compile<'a>(
&'a self,