summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorMartin Haug <mhaug@live.de>2021-05-26 23:36:03 +0200
committerLaurenz <laurmaedje@gmail.com>2021-05-26 23:50:40 +0200
commit8e700606bb64c4ffda87cec333f7c76eae244911 (patch)
tree8d0c40b04bc61cc3e3a9cad2f7b5f2eb4a691892 /src/main.rs
parente27f6c10146240a6c8b92930b27948083f08c9b5 (diff)
Add a cache for unchanged layouts
Co-Authored-By: Laurenz <laurmaedje@gmail.com>
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index 9a112d5a..aef0f573 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -3,6 +3,7 @@ use std::path::{Path, PathBuf};
use anyhow::{anyhow, bail, Context};
+use typst::cache::Cache;
use typst::diag::Pass;
use typst::env::{Env, FsLoader};
use typst::exec::State;
@@ -39,11 +40,12 @@ fn main() -> anyhow::Result<()> {
loader.search_system();
let mut env = Env::new(loader);
-
+ let mut cache = Cache::new();
let scope = library::new();
let state = State::default();
- let Pass { output: frames, diags } = typeset(&mut env, &src, &scope, state);
+ let Pass { output: frames, diags } =
+ typeset(&mut env, &mut cache, &src, &scope, state);
if !diags.is_empty() {
let map = LineMap::new(&src);
for diag in diags {