Struct i_slint_core::graphics::RenderingCache
source · [−]pub struct RenderingCache<T> { /* private fields */ }
Expand description
The RenderingCache, in combination with CachedGraphicsData, allows back ends to store data that’s either intensive to compute or has bad CPU locality. Back ends typically keep a RenderingCache instance and use the item’s cached_rendering_data() integer as index in the vec_arena::Arena.
Implementations
sourceimpl<T> RenderingCache<T>
impl<T> RenderingCache<T>
sourcepub fn generation(&self) -> usize
pub fn generation(&self) -> usize
Returns the generation of the cache. The generation starts at 1 and is increased whenever the cache is cleared, for example when the GL context is lost.
sourcepub fn get_mut(&mut self, index: usize) -> Option<&mut CachedGraphicsData<T>>
pub fn get_mut(&mut self, index: usize) -> Option<&mut CachedGraphicsData<T>>
Retrieves a mutable reference to the cached graphics data at index.
sourcepub fn contains(&self, index: usize) -> bool
pub fn contains(&self, index: usize) -> bool
Returns true if a cache entry exists for the given index.
sourcepub fn insert(&mut self, data: CachedGraphicsData<T>) -> usize
pub fn insert(&mut self, data: CachedGraphicsData<T>) -> usize
Inserts data into the cache and returns the index for retrieval later.
sourcepub fn get(&self, index: usize) -> Option<&CachedGraphicsData<T>>
pub fn get(&self, index: usize) -> Option<&CachedGraphicsData<T>>
Retrieves an immutable reference to the cached graphics data at index.
sourcepub fn remove(&mut self, index: usize) -> CachedGraphicsData<T>
pub fn remove(&mut self, index: usize) -> CachedGraphicsData<T>
Removes the cached graphics data at the given index.
Trait Implementations
Auto Trait Implementations
impl<T> !RefUnwindSafe for RenderingCache<T>
impl<T> !Send for RenderingCache<T>
impl<T> !Sync for RenderingCache<T>
impl<T> Unpin for RenderingCache<T> where
T: Unpin,
impl<T> !UnwindSafe for RenderingCache<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