1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use std::cmp::Ordering;
#[derive(Default,Debug,Clone,Copy)]
pub struct Priority{
priority:f64
}
impl Priority{
pub fn new(priority:f64)->Priority{
Priority{priority}
}
}
impl PartialOrd for Priority {
fn partial_cmp(&self, other: &Priority) -> Option<Ordering> {
Some(self.cmp(other))
}
}
impl Ord for Priority{
fn cmp(&self,other:&Priority)->Ordering{
if self.priority==other.priority{
Ordering::Equal
}else if self.priority>other.priority{
Ordering::Greater
}else{
Ordering::Less
}
}
}
impl PartialEq for Priority {
fn eq(&self, other: &Priority) -> bool {
self.priority == other.priority
}
}
impl Eq for Priority {}
impl Into<f64> for Priority {
fn into(self) -> f64 {
self.priority
}
}