Skip to content

Commit

Permalink
reverts use of NonZeroUsize for LRU capacity instead of usize
Browse files Browse the repository at this point in the history
NonZeroUsize for capacity is very nonergonomic and prevents some
use-cases. For example a usize allows to disable caching by using
capacity zero. see: jeromefroe#165

This reverts commit 0e415ef.
  • Loading branch information
behzadnouri committed Aug 3, 2023
1 parent 8f605c5 commit 4fa447d
Show file tree
Hide file tree
Showing 2 changed files with 158 additions and 158 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ 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(NonZeroUsize::new(2).unwrap());
let mut cache = LruCache::new(2);
cache.put("apple", 3);
cache.put("banana", 2);
Expand Down
Loading

0 comments on commit 4fa447d

Please sign in to comment.