pub struct CrateCache { /* private fields */ }
Expand description
A cache for storing and retrieving Crate
instances to minimize redundant operations.
This cache uses a least-recently-used (LRU) strategy and is thread-safe.
Implementations§
Source§impl CrateCache
impl CrateCache
Sourcepub fn new(capacity: NonZeroUsize) -> Self
pub fn new(capacity: NonZeroUsize) -> Self
Creates a new CrateCache
with a specified capacity.
Sourcepub fn get_crate(&self, crate_version: &CrateVersion) -> Option<Crate>
pub fn get_crate(&self, crate_version: &CrateVersion) -> Option<Crate>
Retrieves a crate from the cache if it exists.
Trait Implementations§
Source§impl Clone for CrateCache
impl Clone for CrateCache
Source§fn clone(&self) -> CrateCache
fn clone(&self) -> CrateCache
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for CrateCache
impl !RefUnwindSafe for CrateCache
impl Send for CrateCache
impl Sync for CrateCache
impl Unpin for CrateCache
impl !UnwindSafe for CrateCache
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