lru_cache: restrict and annotate Send impl

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2020-06-17 13:44:21 +02:00
parent 6ef9bb59eb
commit e303077132
1 changed files with 2 additions and 1 deletions

View File

@ -100,7 +100,8 @@ pub struct LruCache<K, V> {
_marker: PhantomData<Box<CacheNode<K, V>>>,
}
unsafe impl<K, V> Send for LruCache<K, V> {}
// trivial: if our contents are Send, the whole cache is Send
unsafe impl<K: Send, V: Send> Send for LruCache<K, V> {}
impl<K: std::cmp::Eq + std::hash::Hash + Copy, V> LruCache<K, V> {
/// Create LRU cache instance which holds up to `capacity` nodes at once.