pub struct Cache { /* private fields */ }
Available on crate feature
pure
only.Expand description
Implementations
sourceimpl Cache
impl Cache
sourcepub fn clear(&mut self)
Available on crate feature canvas
only.
pub fn clear(&mut self)
canvas
only.Clears the Cache
, forcing a redraw the next time it is used.
sourcepub fn draw(&self, bounds: Size<f32>, draw_fn: impl Fn(&mut Frame)) -> Geometry
Available on crate feature canvas
only.
pub fn draw(&self, bounds: Size<f32>, draw_fn: impl Fn(&mut Frame)) -> Geometry
canvas
only.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.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Cache
impl Send for Cache
impl !Sync for Cache
impl Unpin for Cache
impl UnwindSafe for Cache
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more