1/// Trait used to retrieve the weight of a key-value pair.
2pub trait WeightScale<K, V> {
3 /// Returns the weight of a key-value pair.
4 fn weight(&self, key: &K, value: &V) -> usize;
5}
6
7/// A scale that always return 0.
8#[derive(Clone, Copy, Debug, Default)]
9pub struct ZeroWeightScale;
10
11impl<K, V> WeightScale<K, V> for ZeroWeightScale {
12 #[inline]
13 fn weight(&self, _: &K, _: &V) -> usize {
14 0
15 }
16}
17