summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-05-27 14:48:55 +0200
committerLaurenz <laurmaedje@gmail.com>2021-05-27 14:48:55 +0200
commiteabf28f08187bd9a10bbadbbaf9617e2bc1949aa (patch)
tree0fd890167ab912a9f7efb2beabcd55000f05f96e
parentb886ced40825372000df0fa9cddff98a1b642cc6 (diff)
Remove hash() from AnyNode since caching is now fully transparent
-rw-r--r--src/layout/mod.rs9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs
index a025fbc2..bdcf5ec4 100644
--- a/src/layout/mod.rs
+++ b/src/layout/mod.rs
@@ -88,23 +88,18 @@ impl AnyNode {
Self { node: Box::new(node), hash }
}
-
- /// The cached hash for the boxed node.
- pub fn hash(&self) -> u64 {
- self.hash
- }
}
impl Layout for AnyNode {
fn layout(&self, ctx: &mut LayoutContext, regions: &Regions) -> Vec<Frame> {
- if let Some(hit) = ctx.cache.frames.get(&self.hash()) {
+ if let Some(hit) = ctx.cache.frames.get(&self.hash) {
if &hit.regions == regions {
return hit.frames.clone();
}
}
let frames = self.node.layout(ctx, regions);
- ctx.cache.frames.insert(self.hash(), FramesEntry {
+ ctx.cache.frames.insert(self.hash, FramesEntry {
regions: regions.clone(),
frames: frames.clone(),
});