Skip to content

Commit

Permalink
Create internal hashmap with specified capacity
Browse files Browse the repository at this point in the history
  • Loading branch information
Jerome Froelich committed Jan 2, 2017
1 parent 1c1e2b9 commit b1dae7a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## [v0.1.3](https://github.com/jeromefroe/lru-rs/tree/0.1.2) - 2017-01-02

* Create internal hashmap with specified capacity.

## [v0.1.2](https://github.com/jeromefroe/lru-rs/tree/0.1.2) - 2017-01-02

* Add `peek` and `contains` functions.
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lru"
version = "0.1.2"
version = "0.1.3"
authors = ["Jerome Froelich <jeromefroelic@hotmail.com>"]
description = "A LRU cache implementation"
homepage = "https://github.com/jeromefroe/lru-rs"
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ impl<K: Hash + Eq, V> LruCache<K, V> {
/// ```
pub fn new(cap: usize) -> LruCache<K, V> {
let mut cache = LruCache {
map: HashMap::new(),
map: HashMap::with_capacity(cap),
cap: cap,
head: unsafe { Box::into_raw(Box::new(mem::uninitialized::<LruEntry<K, V>>())) },
tail: unsafe { Box::into_raw(Box::new(mem::uninitialized::<LruEntry<K, V>>())) },
Expand Down

0 comments on commit b1dae7a

Please sign in to comment.