diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-06-30 00:43:53 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-06-30 00:43:53 +0200 |
| commit | d5d2b80699a002594f429e30f5f1ca0ca58d3412 (patch) | |
| tree | 15e0f0565d4aa7c8230cb76b057b99761788c86c /src/layout/incremental.rs | |
| parent | 2f44d10aa4209b226cfc3d0f8f2c8516005edf6a (diff) | |
| parent | ff0e3442ef68a23dba273122f3ba0a54a34c45bf (diff) | |
Merge pull request #34 from typst/cfg-conditional
Put incremental compilation behind feature
Diffstat (limited to 'src/layout/incremental.rs')
| -rw-r--r-- | src/layout/incremental.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/layout/incremental.rs b/src/layout/incremental.rs index 9eda0402..1dd90f8e 100644 --- a/src/layout/incremental.rs +++ b/src/layout/incremental.rs @@ -1,3 +1,4 @@ +#[cfg(feature = "layout-cache")] use std::collections::{hash_map::Entry, HashMap}; use std::ops::Deref; @@ -5,6 +6,7 @@ use super::*; /// Caches layouting artifacts. #[derive(Default, Debug, Clone)] +#[cfg(feature = "layout-cache")] pub struct LayoutCache { /// Maps from node hashes to the resulting frames and regions in which the /// frames are valid. The right hand side of the hash map is a vector of @@ -15,6 +17,7 @@ pub struct LayoutCache { age: usize, } +#[cfg(feature = "layout-cache")] impl LayoutCache { /// Create a new, empty layout cache. pub fn new() -> Self { @@ -100,6 +103,7 @@ impl LayoutCache { /// Cached frames from past layouting. #[derive(Debug, Clone)] +#[cfg(feature = "layout-cache")] pub struct FramesEntry { /// The cached frames for a node. pub frames: Vec<Constrained<Rc<Frame>>>, @@ -112,6 +116,7 @@ pub struct FramesEntry { temperature: [usize; 5], } +#[cfg(feature = "layout-cache")] impl FramesEntry { /// Construct a new instance. pub fn new(frames: Vec<Constrained<Rc<Frame>>>, level: usize) -> Self { @@ -205,6 +210,7 @@ impl Constraints { } } + #[cfg(feature = "layout-cache")] fn check(&self, regions: &Regions) -> bool { if self.expand != regions.expand { return false; |
