summaryrefslogtreecommitdiff
path: root/crates/typst-cli/src
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2024-05-13 19:54:34 +0200
committerGitHub <noreply@github.com>2024-05-13 17:54:34 +0000
commit2d32ac73b63c81ea2754916feb7758c042f4ed3d (patch)
treec9770897cbb1134187132d6835702a1869a74a0a /crates/typst-cli/src
parent95cd6adf24cb14ede8896fbb0c610432960f4f3a (diff)
Replace all `Prehashed` with `LazyHash` (#4127)
Diffstat (limited to 'crates/typst-cli/src')
-rw-r--r--crates/typst-cli/src/world.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/crates/typst-cli/src/world.rs b/crates/typst-cli/src/world.rs
index 57aecd42..81fece2a 100644
--- a/crates/typst-cli/src/world.rs
+++ b/crates/typst-cli/src/world.rs
@@ -5,7 +5,6 @@ use std::sync::OnceLock;
use std::{fmt, fs, io, mem};
use chrono::{DateTime, Datelike, FixedOffset, Local, Utc};
-use comemo::Prehashed;
use ecow::{eco_format, EcoString};
use once_cell::sync::Lazy;
use parking_lot::Mutex;
@@ -13,6 +12,7 @@ use typst::diag::{FileError, FileResult};
use typst::foundations::{Bytes, Datetime, Dict, IntoValue};
use typst::syntax::{FileId, Source, VirtualPath};
use typst::text::{Font, FontBook};
+use typst::utils::LazyHash;
use typst::{Library, World};
use typst_timing::{timed, TimingScope};
@@ -34,9 +34,9 @@ pub struct SystemWorld {
/// The input path.
main: FileId,
/// Typst's standard library.
- library: Prehashed<Library>,
+ library: LazyHash<Library>,
/// Metadata about discovered fonts.
- book: Prehashed<FontBook>,
+ book: LazyHash<FontBook>,
/// Locations of and storage for lazily loaded fonts.
fonts: Vec<FontSlot>,
/// Maps file ids to source files and buffers.
@@ -114,8 +114,8 @@ impl SystemWorld {
workdir: std::env::current_dir().ok(),
root,
main,
- library: Prehashed::new(library),
- book: Prehashed::new(searcher.book),
+ library: LazyHash::new(library),
+ book: LazyHash::new(searcher.book),
fonts: searcher.fonts,
slots: Mutex::new(HashMap::new()),
now,
@@ -170,11 +170,11 @@ impl SystemWorld {
}
impl World for SystemWorld {
- fn library(&self) -> &Prehashed<Library> {
+ fn library(&self) -> &LazyHash<Library> {
&self.library
}
- fn book(&self) -> &Prehashed<FontBook> {
+ fn book(&self) -> &LazyHash<FontBook> {
&self.book
}