newer_type_std/
cmp.rs

1use crate::emit_traits;
2use newer_type::target;
3
4emit_traits! {
5    #[implement_of(newer_type_std::cmp::PartialEq)]
6    #[slot(u8)]
7    #[target(alternative = ::core::cmp::PartialEq)]
8    pub trait PartialEq[Rhs = Self]
9    where [Rhs: ?::core::marker::Sized,]
10    {
11        fn eq(&self, other: &Rhs) -> ::core::primitive::bool;
12        fn ne(&self, other: &Rhs) -> ::core::primitive::bool;
13    }
14
15    #[implement_of(newer_type_std::cmp::PartialEq)]
16    #[implement_of(newer_type_std::cmp::Eq)]
17    #[slot(u8)]
18    #[target(alternative = ::core::cmp::Eq)]
19    pub trait Eq: [::core::cmp::PartialEq] {}
20
21
22    #[implement_of(newer_type_std::cmp::PartialEq)]
23    #[implement_of(newer_type_std::cmp::PartialOrd)]
24    #[slot(u8)]
25    #[target(alternative = ::core::cmp::PartialOrd)]
26    pub trait PartialOrd[Rhs = Self]: [::core::cmp::PartialEq<Rhs>]
27    where [Rhs: ?::core::marker::Sized,]
28    {
29        fn partial_cmp(&self, other: &Rhs)
30            -> ::core::option::Option<::core::cmp::Ordering>;
31
32        fn lt(&self, other: &Rhs) -> ::core::primitive::bool;
33        fn le(&self, other: &Rhs) -> ::core::primitive::bool;
34        fn gt(&self, other: &Rhs) -> ::core::primitive::bool;
35        fn ge(&self, other: &Rhs) -> ::core::primitive::bool;
36    }
37
38    #[implement_of(newer_type_std::cmp::PartialEq)]
39    #[implement_of(newer_type_std::cmp::Eq)]
40    #[implement_of(newer_type_std::cmp::PartialOrd)]
41    #[implement_of(newer_type_std::cmp::Ord)]
42    #[slot(u8)]
43    #[target(alternative = ::core::cmp::Ord)]
44    pub trait Ord: [::core::cmp::Eq + ::core::cmp::PartialOrd] {
45        fn cmp(&self, other: &Self) -> ::core::cmp::Ordering;
46        // fn max(self, other: Self) -> Self
47        // where
48        //     Self: ::core::marker::Sized;
49        // fn min(self, other: Self) -> Self
50        // where
51        //     Self: ::core::marker::Sized;
52        // fn clamp(self, min: Self, max: Self) -> Self
53        // where
54        //     Self: ::core::marker::Sized;
55    }
56}