Struct i_slint_core::item_rendering::ItemCache
source · [−]pub struct ItemCache<T> { /* private fields */ }
Expand description
A per-item cache.
Cache rendering information for a given item.
Use ItemCache::get_or_update_cache_entry
to get or update the items, the
cache is automatically invalided when the property gets dirty.
ItemCache::component_destroyed
must be called to clear the cache for that
component.
Implementations
sourceimpl<T: Clone> ItemCache<T>
impl<T: Clone> ItemCache<T>
sourcepub fn get_or_update_cache_entry(
&self,
item_rc: &ItemRc,
update_fn: impl FnOnce() -> T
) -> T
pub fn get_or_update_cache_entry(
&self,
item_rc: &ItemRc,
update_fn: impl FnOnce() -> T
) -> T
Returns the cached value associated to the item_rc
if it is still valid.
Otherwise call the update_fn
to compute that value, and track property access
so it is automatically invalided when property becomes dirty.
sourcepub fn component_destroyed(&self, component: ComponentRef<'_>)
pub fn component_destroyed(&self, component: ComponentRef<'_>)
Function that must be called when a component is destroyed.
Usually can be called from crate::window::PlatformWindow::unregister_component
Trait Implementations
Auto Trait Implementations
impl<T> !RefUnwindSafe for ItemCache<T>
impl<T> !Send for ItemCache<T>
impl<T> !Sync for ItemCache<T>
impl<T> Unpin for ItemCache<T> where
T: Unpin,
impl<T> !UnwindSafe for ItemCache<T>
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