pub type Cache<Renderer = Renderer> = Cache<Renderer>;
Expand description
Aliased Type§
struct Cache<Renderer = Renderer> { /* private fields */ }
Implementations
source§impl<Renderer> Cache<Renderer>where
Renderer: Renderer,
impl<Renderer> Cache<Renderer>where
Renderer: Renderer,
sourcepub fn with_group(group: Group) -> Cache<Renderer>
pub fn with_group(group: Group) -> Cache<Renderer>
sourcepub fn draw(
&self,
renderer: &Renderer,
bounds: Size,
draw_fn: impl FnOnce(&mut Frame<Renderer>),
) -> <Renderer as Renderer>::Geometry
pub fn draw( &self, renderer: &Renderer, bounds: Size, draw_fn: impl FnOnce(&mut Frame<Renderer>), ) -> <Renderer as Renderer>::Geometry
Draws geometry using the provided closure and stores it in the
Cache
.
The closure will only be called when
- the bounds have changed since the previous draw call.
- the
Cache
is empty or has been explicitly cleared.
Otherwise, the previously stored geometry will be returned. The
Cache
is not cleared in this case. In other words, it will keep
returning the stored geometry if needed.