mirror of
https://github.com/servo/servo.git
synced 2025-08-12 00:45:33 +01:00
~[] to Vec in util/cache.rs
This commit is contained in:
parent
33d0a3af09
commit
631f70b1c5
1 changed files with 3 additions and 3 deletions
|
@ -120,14 +120,14 @@ fn test_hashcache() {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct LRUCache<K, V> {
|
pub struct LRUCache<K, V> {
|
||||||
entries: ~[(K, V)],
|
entries: Vec<(K, V)>,
|
||||||
cache_size: uint,
|
cache_size: uint,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<K: Clone + Eq, V: Clone> LRUCache<K,V> {
|
impl<K: Clone + Eq, V: Clone> LRUCache<K,V> {
|
||||||
pub fn new(size: uint) -> LRUCache<K, V> {
|
pub fn new(size: uint) -> LRUCache<K, V> {
|
||||||
LRUCache {
|
LRUCache {
|
||||||
entries: ~[],
|
entries: Vec::new(),
|
||||||
cache_size: size,
|
cache_size: size,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ impl<K: Clone + Eq, V: Clone> LRUCache<K,V> {
|
||||||
let entry = self.entries.remove(pos);
|
let entry = self.entries.remove(pos);
|
||||||
self.entries.push(entry.unwrap());
|
self.entries.push(entry.unwrap());
|
||||||
}
|
}
|
||||||
self.entries[last_index].ref1().clone()
|
self.entries.get(last_index).ref1().clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn iter<'a>(&'a self) -> Items<'a,(K,V)> {
|
pub fn iter<'a>(&'a self) -> Items<'a,(K,V)> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue