pub trait CacheTree {
// Required methods
fn cache_get(
&self,
node_id: NodeId,
input: &LayoutInput,
) -> Option<LayoutOutput>;
fn cache_store(
&mut self,
node_id: NodeId,
input: &LayoutInput,
layout_output: LayoutOutput,
);
fn cache_clear(&mut self, node_id: NodeId);
}Expand description
Trait used by the compute_cached_layout method which allows cached layout results to be stored and retrieved.
The Cache struct implements a per-node cache that is compatible with this trait.
Required Methods§
Sourcefn cache_get(
&self,
node_id: NodeId,
input: &LayoutInput,
) -> Option<LayoutOutput>
fn cache_get( &self, node_id: NodeId, input: &LayoutInput, ) -> Option<LayoutOutput>
Try to retrieve a cached result from the cache
Sourcefn cache_store(
&mut self,
node_id: NodeId,
input: &LayoutInput,
layout_output: LayoutOutput,
)
fn cache_store( &mut self, node_id: NodeId, input: &LayoutInput, layout_output: LayoutOutput, )
Store a computed size in the cache
Sourcefn cache_clear(&mut self, node_id: NodeId)
fn cache_clear(&mut self, node_id: NodeId)
Clear all cache entries for the node