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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//! There aren't that many implementations in [`std`]...

use crate::{Array, Slice};
use core::cmp::Ordering;

#[cfg(feature = "alloc")]
use crate::Vec;

impl<T> PartialOrd for Slice<T>
where
    T: PartialOrd,
{
    fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
        <[_] as PartialOrd>::partial_cmp(self, other)
    }
}

impl<T> Ord for Slice<T>
where
    T: Ord,
{
    fn cmp(&self, other: &Self) -> Ordering {
        <[_] as Ord>::cmp(self, other)
    }
}

impl<const N: usize, T> PartialOrd for Array<T, N>
where
    T: PartialOrd,
{
    fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
        <[_] as PartialOrd>::partial_cmp(self, other)
    }
}
impl<const N: usize, T> Ord for Array<T, N>
where
    T: Ord,
{
    fn cmp(&self, other: &Self) -> Ordering {
        <[_] as Ord>::cmp(self, other)
    }
}

#[cfg(feature = "alloc")]
#[cfg_attr(do_doc_cfg, doc(cfg(feature = "alloc")))]
impl<T> PartialOrd<Vec<T>> for Vec<T>
where
    T: PartialOrd,
{
    fn partial_cmp(&self, other: &Vec<T>) -> Option<Ordering> {
        <[_] as PartialOrd>::partial_cmp(self, other)
    }
}

#[cfg(feature = "alloc")]
impl<T> Ord for Vec<T>
where
    T: Ord,
{
    fn cmp(&self, other: &Self) -> Ordering {
        <[_] as Ord>::cmp(self, other)
    }
}