priority_async_mutex/
pv.rs1use std::cmp::Ordering;
2
3#[derive(Debug, Clone, Default)]
5pub struct PV<P, V> {
6 pub p: P,
7 pub v: V,
8}
9
10impl<P: PartialEq, V> PartialEq for PV<P, V> {
11 fn eq(&self, other: &PV<P, V>) -> bool {
12 other.p == self.p
13 }
14}
15
16impl<P: Eq, V> Eq for PV<P, V> {}
17
18impl<P: PartialOrd, V> PartialOrd for PV<P, V> {
19 fn partial_cmp(&self, other: &PV<P, V>) -> Option<Ordering> {
20 other.p.partial_cmp(&self.p)
21 }
22}
23
24impl<P: Ord, V> Ord for PV<P, V> {
25 fn cmp(&self, other: &PV<P, V>) -> Ordering {
26 other.p.cmp(&self.p)
27 }
28}