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>
impl<Key: Eq + Hash, Value> FramePublisher<Key, Value>
pub fn new() -> Self
sourcepub fn set(&mut self, key: Key, value: Value)
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.
sourcepub fn get(&self, key: &Key) -> Option<&Value>
pub fn get(&self, key: &Key) -> Option<&Value>
Retrieve a value if it was published this or the previous frame.
sourcepub fn evict_cache(&mut self)
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>
impl<Key, Value> CacheTrait for FramePublisher<Key, Value>
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>
impl<Key, Value> Sync for FramePublisher<Key, Value>
impl<Key, Value> Unpin for FramePublisher<Key, Value>
impl<Key, Value> UnwindSafe for FramePublisher<Key, Value>where
Key: UnwindSafe,
Value: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more