Skip to main content

stack_array/
comparisons.rs

1//^
2//^ HEAD
3//^
4
5//> HEAD -> IMPORTS
6use {
7    super::Array,
8    core::cmp::Ordering
9};
10
11
12//^
13//^ EQ
14//^
15
16//> EQ -> PARTIAL CONTAINER
17const impl<
18    Type: [const] PartialEq<Type>, 
19    To: [const] AsRef<[Type]>, 
20    const N: usize
21> PartialEq<To> for Array<Type, N> {
22    fn eq(&self, other: &To) -> bool {return self.as_ref().eq(other.as_ref())}
23}
24
25//> EQ -> TOTAL
26const impl<Type: [const] Eq, const N: usize> Eq for Array<Type, N> {}
27
28
29//^
30//^ CMP
31//^
32
33//> CMP -> PARTIAL CONTAINER
34const impl<
35    Type: [const] PartialOrd<Type>, 
36    To: [const] AsRef<[Type]>, 
37    const N: usize
38> PartialOrd<To> for Array<Type, N> {
39    fn partial_cmp(&self, other: &To) -> Option<Ordering> {
40        return self.as_ref().partial_cmp(other.as_ref());
41    }
42}
43
44//> CMP -> TOTAL
45const impl<Type: [const] Ord, const N: usize> Ord for Array<Type, N> {
46    fn cmp(&self, other: &Self) -> Ordering {return self.as_ref().cmp(other.as_ref())}
47}