MCPcopy Create free account
hub / github.com/QMHTMY/RustBook / main

Function main

publication/code/chapter10/lru.rs:175–190  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

173}
174
175fn main() {
176 let mut cache = LRUCache::with_capacity(2);
177 cache.insert("foo", 1);
178 cache.insert("bar", 2);
179 cache.insert("baz", 3);
180 cache.insert("tik", 4);
181 cache.insert("tok", 5);
182
183 assert!(!cache.contains(&"foo"));
184 assert!(!cache.contains(&"bar"));
185 assert!(cache.contains(&"baz"));
186 assert!(cache.contains(&"tik"));
187
188 cache.insert("qux", 6);
189 assert!(cache.contains(&"qux"));
190}

Callers

nothing calls this directly

Calls 1

insertMethod · 0.45

Tested by

no test coverage detected