File tree Expand file tree Collapse file tree 2 files changed +3
-1
lines changed
Expand file tree Collapse file tree 2 files changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ nom = "7.1"
2828cookie-factory = " 0.3"
2929get_if_addrs = " 0.5"
3030thiserror = " 1.0"
31- lru = " 0.7 "
31+ lru = " 0.8 "
3232bitflags = " 1.3"
3333itertools = " 0.10"
3434rand = " 0.8"
Original file line number Diff line number Diff line change 11//! LRU cache for `SalsaBox`es.
22
33use std:: sync:: Arc ;
4+ use std:: num:: NonZeroUsize ;
45
56use crypto_box:: SalsaBox ;
67use lru:: LruCache ;
@@ -22,6 +23,7 @@ pub struct PrecomputedCache {
2223impl PrecomputedCache {
2324 /// Create new `PrecomputedCache`.
2425 pub fn new ( sk : SecretKey , capacity : usize ) -> PrecomputedCache {
26+ let capacity = NonZeroUsize :: new ( capacity) . expect ( "must be non zero" ) ;
2527 PrecomputedCache {
2628 sk,
2729 precomputed_keys : Arc :: new ( Mutex :: new ( LruCache :: new ( capacity) ) ) ,
You can’t perform that action at this time.
0 commit comments