Skip to content

Commit

Permalink
Use NonZeroUsize for LRU cap instead of usize
Browse files Browse the repository at this point in the history
  • Loading branch information
Yosi-Hezi committed Aug 16, 2022
1 parent 3edfbf4 commit 0e415ef
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

0 comments on commit 0e415ef

Please sign in to comment.