Skip to main content

libutils_pointer/
comparisons.rs

1//^
2//^ HEAD
3//^
4
5//> HEAD -> SUPER
6use super::Pointer;
7
8//> HEAD -> CORE
9use core::{
10    cmp::Ordering,
11    hash::{
12        Hash,
13        Hasher
14    }
15};
16
17
18//^
19//^ COMPARISONS
20//^
21
22//> POINTER -> PARTIAL EQ
23impl<Type> PartialEq for Pointer<Type> {
24    fn eq(&self, other: &Self) -> bool {return self.as_ptr().eq(&other.as_ptr())}
25}
26
27//> POINTER -> PARTIAL ORD
28impl<Type> PartialOrd for Pointer<Type> {
29    fn partial_cmp(&self, other: &Self) -> Option<Ordering> {return self.as_ptr().partial_cmp(&other.as_ptr())}
30}
31
32//> POINTER -> EQ
33impl<Type> Eq for Pointer<Type> {}
34
35//> POINTER -> ORD
36impl<Type> Ord for Pointer<Type> {
37    fn cmp(&self, other: &Self) -> Ordering {return self.as_ptr().cmp(&other.as_ptr())}
38}
39
40//> POINTER -> HASH
41impl<Type> Hash for Pointer<Type> {
42    fn hash<H: Hasher>(&self, state: &mut H) {return Hash::hash(&self.as_ptr(), state)}
43}