summaryrefslogtreecommitdiff
path: root/library
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-05-11 10:50:30 +0200
committerLaurenz <laurmaedje@gmail.com>2023-05-11 10:50:30 +0200
commit47dff3765de863554ca296448555599fc50d4a8a (patch)
treef632073bd800466d94dae7d19b1d4e28e80ff743 /library
parentd9ba84085e36036409c919cff2e3eb3d126e3bb3 (diff)
Remove 'static bound on `World`
Thanks to improvements in comemo, tracked types don't need to be 'static anymore. This means that the 'static bound on the `World` is now lifted and that the `Route` doesn't need to use unsafe code anymore to manage its lifetime.
Diffstat (limited to 'library')
-rw-r--r--library/Cargo.toml2
-rw-r--r--library/src/layout/mod.rs4
-rw-r--r--library/src/layout/par.rs2
-rw-r--r--library/src/meta/bibliography.rs6
-rw-r--r--library/src/meta/counter.rs2
-rw-r--r--library/src/meta/state.rs2
-rw-r--r--library/src/text/shaping.rs4
-rw-r--r--library/src/visualize/image.rs2
8 files changed, 12 insertions, 12 deletions
diff --git a/library/Cargo.toml b/library/Cargo.toml
index c21df83c..d094c7ea 100644
--- a/library/Cargo.toml
+++ b/library/Cargo.toml
@@ -19,7 +19,7 @@ bench = false
typst = { path = ".." }
az = "1.2"
chinese-number = { version = "0.7.2", default-features = false, features = ["number-to-chinese"] }
-comemo = "0.2.2"
+comemo = { git = "https://github.com/typst/comemo" }
csv = "1"
ecow = "0.1"
hayagriva = "0.3"
diff --git a/library/src/layout/mod.rs b/library/src/layout/mod.rs
index 25014498..adfc433a 100644
--- a/library/src/layout/mod.rs
+++ b/library/src/layout/mod.rs
@@ -73,7 +73,7 @@ impl LayoutRoot for Content {
#[comemo::memoize]
fn cached(
content: &Content,
- world: Tracked<dyn World>,
+ world: Tracked<dyn World + '_>,
tracer: TrackedMut<Tracer>,
provider: TrackedMut<StabilityProvider>,
introspector: Tracked<Introspector>,
@@ -139,7 +139,7 @@ impl Layout for Content {
#[comemo::memoize]
fn cached(
content: &Content,
- world: Tracked<dyn World>,
+ world: Tracked<dyn World + '_>,
tracer: TrackedMut<Tracer>,
provider: TrackedMut<StabilityProvider>,
introspector: Tracked<Introspector>,
diff --git a/library/src/layout/par.rs b/library/src/layout/par.rs
index 0c3a9a3c..c7bc5359 100644
--- a/library/src/layout/par.rs
+++ b/library/src/layout/par.rs
@@ -139,7 +139,7 @@ impl ParElem {
#[allow(clippy::too_many_arguments)]
fn cached(
par: &ParElem,
- world: Tracked<dyn World>,
+ world: Tracked<dyn World + '_>,
tracer: TrackedMut<Tracer>,
provider: TrackedMut<StabilityProvider>,
introspector: Tracked<Introspector>,
diff --git a/library/src/meta/bibliography.rs b/library/src/meta/bibliography.rs
index c3046dfc..cdb6a5d6 100644
--- a/library/src/meta/bibliography.rs
+++ b/library/src/meta/bibliography.rs
@@ -121,7 +121,7 @@ impl BibliographyElem {
/// Find all bibliography keys.
pub fn keys(
- world: Tracked<dyn World>,
+ world: Tracked<dyn World + '_>,
introspector: Tracked<Introspector>,
) -> Vec<(EcoString, Option<EcoString>)> {
Self::find(introspector)
@@ -426,7 +426,7 @@ impl Works {
/// Generate all citations and the whole bibliography.
#[comemo::memoize]
fn create(
- world: Tracked<dyn World>,
+ world: Tracked<dyn World + '_>,
bibliography: BibliographyElem,
citations: Vec<CiteElem>,
) -> Arc<Works> {
@@ -582,7 +582,7 @@ fn create(
/// Load bibliography entries from a path.
#[comemo::memoize]
fn load(
- world: Tracked<dyn World>,
+ world: Tracked<dyn World + '_>,
paths: &BibPaths,
) -> StrResult<EcoVec<hayagriva::Entry>> {
let mut result = EcoVec::new();
diff --git a/library/src/meta/counter.rs b/library/src/meta/counter.rs
index 394c4656..50a097af 100644
--- a/library/src/meta/counter.rs
+++ b/library/src/meta/counter.rs
@@ -405,7 +405,7 @@ impl Counter {
#[comemo::memoize]
fn sequence_impl(
&self,
- world: Tracked<dyn World>,
+ world: Tracked<dyn World + '_>,
tracer: TrackedMut<Tracer>,
provider: TrackedMut<StabilityProvider>,
introspector: Tracked<Introspector>,
diff --git a/library/src/meta/state.rs b/library/src/meta/state.rs
index 71c65125..b466bd66 100644
--- a/library/src/meta/state.rs
+++ b/library/src/meta/state.rs
@@ -320,7 +320,7 @@ impl State {
#[comemo::memoize]
fn sequence_impl(
&self,
- world: Tracked<dyn World>,
+ world: Tracked<dyn World + '_>,
tracer: TrackedMut<Tracer>,
provider: TrackedMut<StabilityProvider>,
introspector: Tracked<Introspector>,
diff --git a/library/src/text/shaping.rs b/library/src/text/shaping.rs
index 7d5703bc..e670d0d1 100644
--- a/library/src/text/shaping.rs
+++ b/library/src/text/shaping.rs
@@ -448,8 +448,8 @@ impl Debug for ShapedText<'_> {
}
/// Holds shaping results and metadata common to all shaped segments.
-struct ShapingContext<'a> {
- vt: &'a Vt<'a>,
+struct ShapingContext<'a, 'v> {
+ vt: &'a Vt<'v>,
spans: &'a SpanMapper,
glyphs: Vec<ShapedGlyph>,
used: Vec<Font>,
diff --git a/library/src/visualize/image.rs b/library/src/visualize/image.rs
index 69eaa5bd..917f483e 100644
--- a/library/src/visualize/image.rs
+++ b/library/src/visualize/image.rs
@@ -165,7 +165,7 @@ pub enum ImageFit {
/// Load an image from a path.
#[comemo::memoize]
fn load(
- world: Tracked<dyn World>,
+ world: Tracked<dyn World + '_>,
full: &str,
fallback_family: Option<&str>,
alt: Option<EcoString>,