Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/contain-rs/lru-cache
/ functions
Functions
32 in github.com/contain-rs/lru-cache
⨍
Functions
32
◇
Types & classes
4
↓ 35 callers
Method
insert
Inserts a key-value pair into the cache. If the key already existed, the old value is returned. # Examples ``` use lru_cache::LruCache; let mut cac
src/lib.rs:122
↓ 3 callers
Method
remove
Removes the given key from the cache and returns its corresponding value. # Examples ``` use lru_cache::LruCache; let mut cache = LruCache::new(2);
src/lib.rs:172
↓ 2 callers
Method
get_mut
Returns a mutable reference to the value corresponding to the given key in the cache, if any. # Examples ``` use lru_cache::LruCache; let mut cache
src/lib.rs:148
↓ 2 callers
Method
iter
Returns an iterator over the cache's key-value pairs in least- to most-recently-used order. Accessing the cache through the iterator does _not_ affec
src/lib.rs:285
↓ 2 callers
Method
len
Returns the number of key-value pairs in the cache.
src/lib.rs:253
↓ 2 callers
Method
remove_lru
(&mut self)
src/lib.rs:248
↓ 2 callers
Method
set_capacity
Sets the number of key-value pairs the cache can hold. Removes least-recently-used key-value pairs if necessary. # Examples ``` use lru_cache::LruCa
src/lib.rs:225
↓ 1 callers
Method
capacity
Returns the maximum number of key-value pairs the cache can hold. # Examples ``` use lru_cache::LruCache; let mut cache: LruCache<i32, &str> = LruCa
src/lib.rs:189
↓ 1 callers
Method
clear
Removes all key-value pairs from the cache.
src/lib.rs:263
↓ 1 callers
Method
iter_mut
Returns an iterator over the cache's key-value pairs in least- to most-recently-used order, with mutable references to the values. Accessing the cach
src/lib.rs:318
Method
clone
(&self)
src/lib.rs:418
Method
contains_key
Checks if the map contains the given key. # Examples ``` use lru_cache::LruCache; let mut cache = LruCache::new(1); cache.insert(1, "a"); assert_e
src/lib.rs:99
Method
extend
(&mut self, iter: I)
src/lib.rs:324
Method
fmt
(&self, f: &mut fmt::Formatter)
src/lib.rs:332
Method
heap_size_of_children
(&self)
src/heapsize.rs:9
Method
into_iter
(self)
src/lib.rs:341
Method
is_empty
Returns `true` if the cache contains no key-value pairs.
src/lib.rs:258
Method
new
Creates an empty cache that can hold at most `capacity` items. # Examples ``` use lru_cache::LruCache; let mut cache: LruCache<i32, &str> = LruCache
src/lib.rs:70
Method
next
(&mut self)
src/lib.rs:391
Method
next_back
(&mut self)
src/lib.rs:401
Method
size_hint
(&self)
src/lib.rs:395
Function
test_change_capacity
()
src/lib.rs:529
Function
test_clear
()
src/lib.rs:578
Function
test_contains_key
()
src/lib.rs:497
Function
test_debug
()
src/lib.rs:540
Function
test_expire_lru
()
src/lib.rs:504
Function
test_iter
()
src/lib.rs:589
Function
test_pop
()
src/lib.rs:516
Function
test_put_and_get
()
src/lib.rs:478
Function
test_put_update
()
src/lib.rs:488
Function
test_remove
()
src/lib.rs:557
Method
with_hasher
Creates an empty cache that can hold at most `capacity` items with the given hash builder.
src/lib.rs:80