diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-03-10 20:47:23 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-03-10 21:19:50 +0100 |
| commit | a9fdff244aef859449a76e5f762ee7c343a8ddcc (patch) | |
| tree | 172b543183296b4bc30b3008650f594688467914 /src/model/realize.rs | |
| parent | 62f35602a87574dcc607f1637aeae1be574981ff (diff) | |
Expose content representation more
Diffstat (limited to 'src/model/realize.rs')
| -rw-r--r-- | src/model/realize.rs | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/src/model/realize.rs b/src/model/realize.rs index 502774bb..c4c67a4f 100644 --- a/src/model/realize.rs +++ b/src/model/realize.rs @@ -3,11 +3,11 @@ use crate::diag::SourceResult; /// Whether the target is affected by show rules in the given style chain. pub fn applicable(target: &Content, styles: StyleChain) -> bool { - if target.has::<dyn Prepare>() && !target.is_prepared() { + if target.can::<dyn Prepare>() && !target.is_prepared() { return true; } - if target.has::<dyn Show>() && target.is_pristine() { + if target.can::<dyn Show>() && target.is_pristine() { return true; } @@ -51,7 +51,7 @@ pub fn realize( if let Some(showable) = target.with::<dyn Show>() { let guard = Guard::Base(target.id()); if realized.is_none() && !target.is_guarded(guard) { - realized = Some(showable.show(vt, target, styles)?); + realized = Some(showable.show(vt, styles)?); } } @@ -135,23 +135,13 @@ fn try_apply( /// Preparations before execution of any show rule. pub trait Prepare { /// Prepare the node for show rule application. - fn prepare( - &self, - vt: &mut Vt, - this: Content, - styles: StyleChain, - ) -> SourceResult<Content>; + fn prepare(&self, vt: &mut Vt, styles: StyleChain) -> SourceResult<Content>; } /// The base recipe for a node. pub trait Show { /// Execute the base recipe for this node. - fn show( - &self, - vt: &mut Vt, - this: &Content, - styles: StyleChain, - ) -> SourceResult<Content>; + fn show(&self, vt: &mut Vt, styles: StyleChain) -> SourceResult<Content>; } /// Post-process a node after it was realized. |
