lru_cache: restrict and annotate Send impl
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
6ef9bb59eb
commit
e303077132
@ -100,7 +100,8 @@ pub struct LruCache<K, V> {
|
|||||||
_marker: PhantomData<Box<CacheNode<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> {
|
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.
|
/// Create LRU cache instance which holds up to `capacity` nodes at once.
|
||||||
|
Loading…
Reference in New Issue
Block a user