pub trait CacheTree {
// Required methods
fn cache_get(
&self,
node_id: NodeId,
known_dimensions: Size<Option<f32>>,
available_space: Size<AvailableSpace>,
run_mode: RunMode,
) -> Option<LayoutOutput>;
fn cache_store(
&mut self,
node_id: NodeId,
known_dimensions: Size<Option<f32>>,
available_space: Size<AvailableSpace>,
run_mode: RunMode,
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,
known_dimensions: Size<Option<f32>>,
available_space: Size<AvailableSpace>,
run_mode: RunMode,
) -> Option<LayoutOutput>
fn cache_get( &self, node_id: NodeId, known_dimensions: Size<Option<f32>>, available_space: Size<AvailableSpace>, run_mode: RunMode, ) -> Option<LayoutOutput>
Try to retrieve a cached result from the cache
sourcefn cache_store(
&mut self,
node_id: NodeId,
known_dimensions: Size<Option<f32>>,
available_space: Size<AvailableSpace>,
run_mode: RunMode,
layout_output: LayoutOutput,
)
fn cache_store( &mut self, node_id: NodeId, known_dimensions: Size<Option<f32>>, available_space: Size<AvailableSpace>, run_mode: RunMode, 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