Skip to main content

WinnerCache

Struct WinnerCache 

Source
pub struct WinnerCache { /* private fields */ }
Expand description

Bounded startup winner cache invalidating automatically when driver, display mode, or build changes.

Implementations§

Source§

impl WinnerCache

Lookup, recording, and environment invalidation helpers for WinnerCache.

Source

pub fn with_capacity(max_entries: usize) -> Self

Creates an empty WinnerCache retaining up to max_entries verified records.

§Arguments
  • usize - Maximum entry capacity (clamped to >= 1).
§Returns
  • Self - Empty bounded winner cache.
Source

pub fn lookup(&self, key: &WinnerCacheKey) -> Option<WinnerCacheEntry>

Looks up a previously verified startup winner matching exact (device_id, driver_version, display_mode_hz, build_id, scene_profile).

§Arguments
  • &Self - Cache reference.
  • &WinnerCacheKey - Composite environment and scene key.
§Returns
  • Option<WinnerCacheEntry> - Cached verified winner if present.
Source

pub fn record(&mut self, key: WinnerCacheKey, entry: WinnerCacheEntry)

Stores a verified winner entry, evicting the oldest record if the cache is full.

§Arguments
  • &Self - Mutable cache reference.
  • WinnerCacheKey - Composite environment and scene key.
  • WinnerCacheEntry - Verified winner metrics.
Source

pub fn invalidate_stale_environment( &mut self, device_id: &str, driver_version: &str, display_mode_hz_millihz: u32, build_id: &str, ) -> usize

Invalidates every cached entry for device_id whose driver version, display mode, or build ID no longer matches.

§Arguments
  • &Self - Mutable cache reference.
  • &str - Active device identifier.
  • &str - Current graphics driver version.
  • u32 - Current display mode in millihertz.
  • &str - Current build identifier.
§Returns
  • usize - Number of invalidated stale entries removed.
Source

pub fn len(&self) -> usize

Returns the number of cached verified winner entries.

§Arguments
  • &Self - Cache reference.
§Returns
  • usize - Entry count.
Source

pub fn is_empty(&self) -> bool

Returns true when no verified winners are cached.

§Arguments
  • &Self - Cache reference.
§Returns
  • bool - true when empty.
Source§

impl WinnerCache

Source

pub fn get_entries(&self) -> &HashMap<WinnerCacheKey, WinnerCacheEntry>

Source

pub fn get_mut_entries( &mut self, ) -> &mut HashMap<WinnerCacheKey, WinnerCacheEntry>

Source

pub fn set_entries( &mut self, val: HashMap<WinnerCacheKey, WinnerCacheEntry>, ) -> &mut Self

Source

pub fn get_max_entries(&self) -> usize

Source

pub fn get_mut_max_entries(&mut self) -> &mut usize

Source

pub fn set_max_entries(&mut self, val: usize) -> &mut Self

Trait Implementations§

Source§

impl Clone for WinnerCache

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for WinnerCache

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for WinnerCache

Default bounded WinnerCache.

Source§

fn default() -> Self

Creates an empty WinnerCache with DEFAULT_WINNER_CACHE_CAPACITY.

§Returns
  • Self - Empty bounded winner cache.
Source§

impl PartialEq for WinnerCache

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for WinnerCache

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.