Skip to content

Commit

Permalink
Merge pull request #150 from Yosi-Hezi/non_zero_capacity
Browse files Browse the repository at this point in the history
replace usize with NonZeroUsize for LRU's capacity
  • Loading branch information
jeromefroe authored Aug 19, 2022
2 parents 3edfbf4 + 0e415ef commit b491112
Show file tree
Hide file tree
Showing 2 changed files with 124 additions and 107 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ Below is a simple example of how to instantiate and use a LRU cache.
extern crate lru;
use lru::LruCache;
use std::num::NonZeroUsize;
fn main() {
let mut cache = LruCache::new(2);
let mut cache = LruCache::new(NonZeroUsize::new(2).unwrap());
cache.put("apple", 3);
cache.put("banana", 2);
Expand Down
Loading

0 comments on commit b491112

Please sign in to comment.