summaryrefslogtreecommitdiff
path: root/docs
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 /docs
parent95cd6adf24cb14ede8896fbb0c610432960f4f3a (diff)
Replace all `Prehashed` with `LazyHash` (#4127)
Diffstat (limited to 'docs')
-rw-r--r--docs/src/html.rs6
-rw-r--r--docs/src/lib.rs10
2 files changed, 8 insertions, 8 deletions
diff --git a/docs/src/html.rs b/docs/src/html.rs
index e88f0d3d..b5c83895 100644
--- a/docs/src/html.rs
+++ b/docs/src/html.rs
@@ -1,7 +1,6 @@
use std::fmt::{self, Debug, Formatter};
use std::ops::Range;
-use comemo::Prehashed;
use ecow::EcoString;
use heck::{ToKebabCase, ToTitleCase};
use pulldown_cmark as md;
@@ -13,6 +12,7 @@ use typst::foundations::{Bytes, Datetime};
use typst::layout::{Abs, Point, Size};
use typst::syntax::{FileId, Source, VirtualPath};
use typst::text::{Font, FontBook};
+use typst::utils::LazyHash;
use typst::{Library, World};
use unscanny::Scanner;
use yaml_front_matter::YamlFrontMatter;
@@ -457,11 +457,11 @@ fn nest_heading(level: &mut md::HeadingLevel, nesting: usize) {
struct DocWorld(Source);
impl World for DocWorld {
- fn library(&self) -> &Prehashed<Library> {
+ fn library(&self) -> &LazyHash<Library> {
&LIBRARY
}
- fn book(&self) -> &Prehashed<FontBook> {
+ fn book(&self) -> &LazyHash<FontBook> {
&FONTS.0
}
diff --git a/docs/src/lib.rs b/docs/src/lib.rs
index 765e7c7c..66242cbb 100644
--- a/docs/src/lib.rs
+++ b/docs/src/lib.rs
@@ -9,7 +9,6 @@ pub use self::contribs::*;
pub use self::html::*;
pub use self::model::*;
-use comemo::Prehashed;
use ecow::{eco_format, EcoString};
use once_cell::sync::Lazy;
use serde::Deserialize;
@@ -28,6 +27,7 @@ use typst::model::Document;
use typst::model::MODEL;
use typst::symbols::SYMBOLS;
use typst::text::{Font, FontBook, TEXT};
+use typst::utils::LazyHash;
use typst::visualize::VISUALIZE;
use typst::Library;
@@ -54,7 +54,7 @@ static GROUPS: Lazy<Vec<GroupData>> = Lazy::new(|| {
groups
});
-static LIBRARY: Lazy<Prehashed<Library>> = Lazy::new(|| {
+static LIBRARY: Lazy<LazyHash<Library>> = Lazy::new(|| {
let mut lib = Library::default();
lib.styles
.set(PageElem::set_width(Smart::Custom(Abs::pt(240.0).into())));
@@ -62,16 +62,16 @@ static LIBRARY: Lazy<Prehashed<Library>> = Lazy::new(|| {
lib.styles.set(PageElem::set_margin(Margin::splat(Some(Smart::Custom(
Abs::pt(15.0).into(),
)))));
- Prehashed::new(lib)
+ LazyHash::new(lib)
});
-static FONTS: Lazy<(Prehashed<FontBook>, Vec<Font>)> = Lazy::new(|| {
+static FONTS: Lazy<(LazyHash<FontBook>, Vec<Font>)> = Lazy::new(|| {
let fonts: Vec<_> = typst_assets::fonts()
.chain(typst_dev_assets::fonts())
.flat_map(|data| Font::iter(Bytes::from_static(data)))
.collect();
let book = FontBook::from_fonts(&fonts);
- (Prehashed::new(book), fonts)
+ (LazyHash::new(book), fonts)
});
/// Build documentation pages.