Struct egui::cache::FramePublisher

source ·
pub struct FramePublisher<Key: Eq + Hash, Value> {
    generation: u32,
    cache: HashMap<Key, (u32, Value)>,
}
Expand description

Stores a key:value pair for the duration of this frame and the next.

Fields§

§generation: u32§cache: HashMap<Key, (u32, Value)>

Implementations§

source§

impl<Key: Eq + Hash, Value> FramePublisher<Key, Value>

source

pub fn new() -> Self

source

pub fn set(&mut self, key: Key, value: Value)

Publish the value. It will be available for the duration of this and the next frame.

source

pub fn get(&self, key: &Key) -> Option<&Value>

Retrieve a value if it was published this or the previous frame.

source

pub fn evict_cache(&mut self)

Must be called once per frame to clear the cache.

Trait Implementations§

source§

impl<Key, Value> CacheTrait for FramePublisher<Key, Value>
where Key: 'static + Eq + Hash + Send + Sync, Value: 'static + Send + Sync,

source§

fn update(&mut self)

Call once per frame to evict cache.
source§

fn len(&self) -> usize

Number of values currently in the cache.
source§

fn as_any_mut(&mut self) -> &mut dyn Any

source§

impl<Key: Eq + Hash, Value> Default for FramePublisher<Key, Value>

source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<Key, Value> Freeze for FramePublisher<Key, Value>

§

impl<Key, Value> RefUnwindSafe for FramePublisher<Key, Value>
where Key: RefUnwindSafe, Value: RefUnwindSafe,

§

impl<Key, Value> Send for FramePublisher<Key, Value>
where Key: Send, Value: Send,

§

impl<Key, Value> Sync for FramePublisher<Key, Value>
where Key: Sync, Value: Sync,

§

impl<Key, Value> Unpin for FramePublisher<Key, Value>
where Key: Unpin, Value: Unpin,

§

impl<Key, Value> UnwindSafe for FramePublisher<Key, Value>
where Key: UnwindSafe, Value: UnwindSafe,

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.