pub struct RomCache { /* private fields */ }Expand description
In-memory view of the persisted ROM cache.
Internally this is just a HashMap keyed by RomCacheKey, plus the
path of the JSON file on disk. All callers go through RomCache::load
so they never touch the filesystem directly.
Implementations§
Source§impl RomCache
impl RomCache
Sourcepub fn get_valid(
&self,
key: &RomCacheKey,
expected_count: u64,
) -> Option<&RomList>
pub fn get_valid( &self, key: &RomCacheKey, expected_count: u64, ) -> Option<&RomList>
Return cached data only if the platform’s rom_count hasn’t changed
since we cached it. We compare the stored count (from the platforms
endpoint at cache time) against the current count — NOT RomList.total,
which can legitimately differ from rom_count.
Sourcepub fn insert(&mut self, key: RomCacheKey, data: RomList, expected_count: u64)
pub fn insert(&mut self, key: RomCacheKey, data: RomList, expected_count: u64)
Insert (or replace) an entry, then persist to disk.
expected_count is the platform/collection rom_count at this moment.
Auto Trait Implementations§
impl Freeze for RomCache
impl RefUnwindSafe for RomCache
impl Send for RomCache
impl Sync for RomCache
impl Unpin for RomCache
impl UnsafeUnpin for RomCache
impl UnwindSafe for RomCache
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more