diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-07-21 11:25:49 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-07-21 11:28:33 +0200 |
| commit | b0e5212973ce2efcb1433323d67c06eea1a81785 (patch) | |
| tree | 3b040a4e23d2d99157050d95b67376b2fb866618 /src/main.rs | |
| parent | 9488b1b850152eb564dbfefc898c962bdac73eb4 (diff) | |
Fs builder methods + tidy up
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/main.rs b/src/main.rs index f9da37fa..91edff17 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,5 @@ use std::fs; use std::path::{Path, PathBuf}; -use std::rc::Rc; use anyhow::{anyhow, bail, Context}; use same_file::is_same_file; @@ -30,17 +29,18 @@ fn main() -> anyhow::Result<()> { } // Create a loader for fonts and files. - let mut loader = typst::loading::FsLoader::new(); - loader.search_path("fonts"); - loader.search_system(); + let loader = typst::loading::FsLoader::new() + .with_path("fonts") + .with_system() + .wrap(); // Resolve the file id of the source file and read the file. - let src_id = loader.resolve_path(src_path).context("source file not found")?; + let src_id = loader.resolve(src_path).context("source file not found")?; let src = fs::read_to_string(&src_path) .map_err(|_| anyhow!("failed to read source file"))?; // Typeset. - let mut ctx = typst::Context::new(Rc::new(loader)); + let mut ctx = typst::Context::new(loader); let pass = ctx.typeset(src_id, &src); // Print diagnostics. |
