summaryrefslogtreecommitdiff
path: root/src/model
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 /src/model
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 'src/model')
-rw-r--r--src/model/mod.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/model/mod.rs b/src/model/mod.rs
index 4ec7311a..92c4293b 100644
--- a/src/model/mod.rs
+++ b/src/model/mod.rs
@@ -14,7 +14,7 @@ pub use self::styles::*;
pub use typst_macros::element;
-use comemo::{Constraint, Track, Tracked, TrackedMut};
+use comemo::{Track, Tracked, TrackedMut, Validate};
use crate::diag::SourceResult;
use crate::doc::Document;
@@ -25,7 +25,7 @@ use crate::World;
#[comemo::memoize]
#[tracing::instrument(skip(world, tracer, content))]
pub fn typeset(
- world: Tracked<dyn World>,
+ world: Tracked<dyn World + '_>,
mut tracer: TrackedMut<Tracer>,
content: &Content,
) -> SourceResult<Document> {
@@ -42,8 +42,8 @@ pub fn typeset(
loop {
tracing::info!("Layout iteration {iter}");
- let constraint = Constraint::new();
let mut provider = StabilityProvider::new();
+ let constraint = <Introspector as Validate>::Constraint::new();
let mut vt = Vt {
world,
tracer: TrackedMut::reborrow_mut(&mut tracer),
@@ -56,7 +56,7 @@ pub fn typeset(
introspector = Introspector::new(&document.pages);
- if iter >= 5 || introspector.valid(&constraint) {
+ if iter >= 5 || introspector.validate(&constraint) {
break;
}
}
@@ -69,7 +69,7 @@ pub fn typeset(
/// Holds the state needed to [typeset] content.
pub struct Vt<'a> {
/// The compilation environment.
- pub world: Tracked<'a, dyn World>,
+ pub world: Tracked<'a, dyn World + 'a>,
/// The tracer for inspection of the values an expression produces.
pub tracer: TrackedMut<'a, Tracer>,
/// Provides stable identities to elements.