~[] to Vec in util/cache.rs

This commit is contained in:
Matt Murphy 2014-04-27 19:56:56 -05:00 committed by Ms2ger
parent 33d0a3af09
commit 631f70b1c5

View file

@ -120,14 +120,14 @@ fn test_hashcache() {
}
pub struct LRUCache<K, V> {
entries: ~[(K, V)],
entries: Vec<(K, V)>,
cache_size: uint,
}
impl<K: Clone + Eq, V: Clone> LRUCache<K,V> {
pub fn new(size: uint) -> LRUCache<K, V> {
LRUCache {
entries: ~[],
entries: Vec::new(),
cache_size: size,
}
}
@ -139,7 +139,7 @@ impl<K: Clone + Eq, V: Clone> LRUCache<K,V> {
let entry = self.entries.remove(pos);
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)> {