i_slint_core::graphics

Struct 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.

This is used only for the crate::item_rendering::PartialRenderingCache

Implementations§

Source§

impl<T> RenderingCache<T>

Source

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.

Source

pub fn get_mut(&mut self, index: usize) -> Option<&mut CachedGraphicsData<T>>

Retrieves a mutable reference to the cached graphics data at index.

Source

pub fn contains(&self, index: usize) -> bool

Returns true if a cache entry exists for the given index.

Source

pub fn insert(&mut self, data: CachedGraphicsData<T>) -> usize

Inserts data into the cache and returns the index for retrieval later.

Source

pub fn get(&self, index: usize) -> Option<&CachedGraphicsData<T>>

Retrieves an immutable reference to the cached graphics data at index.

Source

pub fn remove(&mut self, index: usize) -> CachedGraphicsData<T>

Removes the cached graphics data at the given index.

Source

pub fn clear(&mut self)

Removes all entries from the cache and increases the cache’s generation count, so that stale index access can be avoided.

Trait Implementations§

Source§

impl<T> Default for RenderingCache<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<T> Freeze for RenderingCache<T>

§

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§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.