A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://doc.rust-lang.org/nightly/src/core/cmp.rs.html below:

cmp.rs - source

1#![stable(feature = "rust1", since = "1.0.0")]
27
28mod bytewise;
29pub(crate) use bytewise::BytewiseEq;
30
31use self::Ordering::*;
32use crate::marker::PointeeSized;
33use crate::ops::ControlFlow;
34
35#[lang = "eq"]
241#[stable(feature = "rust1", since = "1.0.0")]
242#[doc(alias = "==")]
243#[doc(alias = "!=")]
244#[rustc_on_unimplemented(
245    message = "can't compare `{Self}` with `{Rhs}`",
246    label = "no implementation for `{Self} == {Rhs}`",
247    append_const_msg
248)]
249#[rustc_diagnostic_item = "PartialEq"]
250#[const_trait]
251#[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
252pub trait PartialEq<Rhs: PointeeSized = Self>: PointeeSized {
253    #[must_use]
255    #[stable(feature = "rust1", since = "1.0.0")]
256    #[rustc_diagnostic_item = "cmp_partialeq_eq"]
257    fn eq(&self, other: &Rhs) -> bool;
258
259    #[inline]
262    #[must_use]
263    #[stable(feature = "rust1", since = "1.0.0")]
264    #[rustc_diagnostic_item = "cmp_partialeq_ne"]
265    fn ne(&self, other: &Rhs) -> bool {
266        !self.eq(other)
267    }
268}
269
270#[rustc_builtin_macro]
273#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
274#[allow_internal_unstable(core_intrinsics, structural_match)]
275pub macro PartialEq($item:item) {
276    }
278
279#[doc(alias = "==")]
335#[doc(alias = "!=")]
336#[stable(feature = "rust1", since = "1.0.0")]
337#[rustc_diagnostic_item = "Eq"]
338pub trait Eq: PartialEq<Self> + PointeeSized {
339    #[doc(hidden)]
345    #[coverage(off)]
346    #[inline]
347    #[stable(feature = "rust1", since = "1.0.0")]
348    fn assert_receiver_is_total_eq(&self) {}
349}
350
351#[rustc_builtin_macro]
353#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
354#[allow_internal_unstable(core_intrinsics, derive_eq, structural_match)]
355#[allow_internal_unstable(coverage_attribute)]
356pub macro Eq($item:item) {
357    }
359
360#[doc(hidden)]
365#[allow(missing_debug_implementations)]
366#[unstable(feature = "derive_eq", reason = "deriving hack, should not be public", issue = "none")]
367pub struct AssertParamIsEq<T: Eq + PointeeSized> {
368    _field: crate::marker::PhantomData<T>,
369}
370
371#[derive(Clone, Copy, Eq, PartialOrd, Ord, Debug, Hash)]
385#[derive_const(PartialEq)]
386#[stable(feature = "rust1", since = "1.0.0")]
387#[lang = "Ordering"]
391#[repr(i8)]
392pub enum Ordering {
393    #[stable(feature = "rust1", since = "1.0.0")]
395    Less = -1,
396    #[stable(feature = "rust1", since = "1.0.0")]
398    Equal = 0,
399    #[stable(feature = "rust1", since = "1.0.0")]
401    Greater = 1,
402}
403
404impl Ordering {
405    #[inline]
406    const fn as_raw(self) -> i8 {
407        crate::intrinsics::discriminant_value(&self)
409    }
410
411    #[inline]
423    #[must_use]
424    #[rustc_const_stable(feature = "ordering_helpers", since = "1.53.0")]
425    #[stable(feature = "ordering_helpers", since = "1.53.0")]
426    pub const fn is_eq(self) -> bool {
427        self.as_raw() == 0
432    }
433
434    #[inline]
446    #[must_use]
447    #[rustc_const_stable(feature = "ordering_helpers", since = "1.53.0")]
448    #[stable(feature = "ordering_helpers", since = "1.53.0")]
449    pub const fn is_ne(self) -> bool {
450        self.as_raw() != 0
451    }
452
453    #[inline]
465    #[must_use]
466    #[rustc_const_stable(feature = "ordering_helpers", since = "1.53.0")]
467    #[stable(feature = "ordering_helpers", since = "1.53.0")]
468    pub const fn is_lt(self) -> bool {
469        self.as_raw() < 0
470    }
471
472    #[inline]
484    #[must_use]
485    #[rustc_const_stable(feature = "ordering_helpers", since = "1.53.0")]
486    #[stable(feature = "ordering_helpers", since = "1.53.0")]
487    pub const fn is_gt(self) -> bool {
488        self.as_raw() > 0
489    }
490
491    #[inline]
503    #[must_use]
504    #[rustc_const_stable(feature = "ordering_helpers", since = "1.53.0")]
505    #[stable(feature = "ordering_helpers", since = "1.53.0")]
506    pub const fn is_le(self) -> bool {
507        self.as_raw() <= 0
508    }
509
510    #[inline]
522    #[must_use]
523    #[rustc_const_stable(feature = "ordering_helpers", since = "1.53.0")]
524    #[stable(feature = "ordering_helpers", since = "1.53.0")]
525    pub const fn is_ge(self) -> bool {
526        self.as_raw() >= 0
527    }
528
529    #[inline]
559    #[must_use]
560    #[rustc_const_stable(feature = "const_ordering", since = "1.48.0")]
561    #[stable(feature = "rust1", since = "1.0.0")]
562    pub const fn reverse(self) -> Ordering {
563        match self {
564            Less => Greater,
565            Equal => Equal,
566            Greater => Less,
567        }
568    }
569
570    #[inline]
598    #[must_use]
599    #[rustc_const_stable(feature = "const_ordering", since = "1.48.0")]
600    #[stable(feature = "ordering_chaining", since = "1.17.0")]
601    pub const fn then(self, other: Ordering) -> Ordering {
602        match self {
603            Equal => other,
604            _ => self,
605        }
606    }
607
608    #[inline]
637    #[must_use]
638    #[stable(feature = "ordering_chaining", since = "1.17.0")]
639    pub fn then_with<F: FnOnce() -> Ordering>(self, f: F) -> Ordering {
640        match self {
641            Equal => f(),
642            _ => self,
643        }
644    }
645}
646
647#[derive(PartialEq, Eq, Debug, Copy, Default, Hash)]
664#[stable(feature = "reverse_cmp_key", since = "1.19.0")]
665#[repr(transparent)]
666pub struct Reverse<T>(#[stable(feature = "reverse_cmp_key", since = "1.19.0")] pub T);
667
668#[stable(feature = "reverse_cmp_key", since = "1.19.0")]
669impl<T: PartialOrd> PartialOrd for Reverse<T> {
670    #[inline]
671    fn partial_cmp(&self, other: &Reverse<T>) -> Option<Ordering> {
672        other.0.partial_cmp(&self.0)
673    }
674
675    #[inline]
676    fn lt(&self, other: &Self) -> bool {
677        other.0 < self.0
678    }
679    #[inline]
680    fn le(&self, other: &Self) -> bool {
681        other.0 <= self.0
682    }
683    #[inline]
684    fn gt(&self, other: &Self) -> bool {
685        other.0 > self.0
686    }
687    #[inline]
688    fn ge(&self, other: &Self) -> bool {
689        other.0 >= self.0
690    }
691}
692
693#[stable(feature = "reverse_cmp_key", since = "1.19.0")]
694impl<T: Ord> Ord for Reverse<T> {
695    #[inline]
696    fn cmp(&self, other: &Reverse<T>) -> Ordering {
697        other.0.cmp(&self.0)
698    }
699}
700
701#[stable(feature = "reverse_cmp_key", since = "1.19.0")]
702impl<T: Clone> Clone for Reverse<T> {
703    #[inline]
704    fn clone(&self) -> Reverse<T> {
705        Reverse(self.0.clone())
706    }
707
708    #[inline]
709    fn clone_from(&mut self, source: &Self) {
710        self.0.clone_from(&source.0)
711    }
712}
713
714#[doc(alias = "<")]
956#[doc(alias = ">")]
957#[doc(alias = "<=")]
958#[doc(alias = ">=")]
959#[stable(feature = "rust1", since = "1.0.0")]
960#[rustc_diagnostic_item = "Ord"]
961pub trait Ord: Eq + PartialOrd<Self> + PointeeSized {
962    #[must_use]
977    #[stable(feature = "rust1", since = "1.0.0")]
978    #[rustc_diagnostic_item = "ord_cmp_method"]
979    fn cmp(&self, other: &Self) -> Ordering;
980
981    #[stable(feature = "ord_max_min", since = "1.21.0")]
1010    #[inline]
1011    #[must_use]
1012    #[rustc_diagnostic_item = "cmp_ord_max"]
1013    fn max(self, other: Self) -> Self
1014    where
1015        Self: Sized,
1016    {
1017        if other < self { self } else { other }
1018    }
1019
1020    #[stable(feature = "ord_max_min", since = "1.21.0")]
1049    #[inline]
1050    #[must_use]
1051    #[rustc_diagnostic_item = "cmp_ord_min"]
1052    fn min(self, other: Self) -> Self
1053    where
1054        Self: Sized,
1055    {
1056        if other < self { other } else { self }
1057    }
1058
1059    #[must_use]
1076    #[inline]
1077    #[stable(feature = "clamp", since = "1.50.0")]
1078    fn clamp(self, min: Self, max: Self) -> Self
1079    where
1080        Self: Sized,
1081    {
1082        assert!(min <= max);
1083        if self < min {
1084            min
1085        } else if self > max {
1086            max
1087        } else {
1088            self
1089        }
1090    }
1091}
1092
1093#[rustc_builtin_macro]
1096#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
1097#[allow_internal_unstable(core_intrinsics)]
1098pub macro Ord($item:item) {
1099    }
1101
1102#[lang = "partial_ord"]
1333#[stable(feature = "rust1", since = "1.0.0")]
1334#[doc(alias = ">")]
1335#[doc(alias = "<")]
1336#[doc(alias = "<=")]
1337#[doc(alias = ">=")]
1338#[rustc_on_unimplemented(
1339    message = "can't compare `{Self}` with `{Rhs}`",
1340    label = "no implementation for `{Self} < {Rhs}` and `{Self} > {Rhs}`",
1341    append_const_msg
1342)]
1343#[rustc_diagnostic_item = "PartialOrd"]
1344#[allow(multiple_supertrait_upcastable)] pub trait PartialOrd<Rhs: PointeeSized = Self>: PartialEq<Rhs> + PointeeSized {
1346    #[must_use]
1370    #[stable(feature = "rust1", since = "1.0.0")]
1371    #[rustc_diagnostic_item = "cmp_partialord_cmp"]
1372    fn partial_cmp(&self, other: &Rhs) -> Option<Ordering>;
1373
1374    #[inline]
1384    #[must_use]
1385    #[stable(feature = "rust1", since = "1.0.0")]
1386    #[rustc_diagnostic_item = "cmp_partialord_lt"]
1387    fn lt(&self, other: &Rhs) -> bool {
1388        self.partial_cmp(other).is_some_and(Ordering::is_lt)
1389    }
1390
1391    #[inline]
1402    #[must_use]
1403    #[stable(feature = "rust1", since = "1.0.0")]
1404    #[rustc_diagnostic_item = "cmp_partialord_le"]
1405    fn le(&self, other: &Rhs) -> bool {
1406        self.partial_cmp(other).is_some_and(Ordering::is_le)
1407    }
1408
1409    #[inline]
1420    #[must_use]
1421    #[stable(feature = "rust1", since = "1.0.0")]
1422    #[rustc_diagnostic_item = "cmp_partialord_gt"]
1423    fn gt(&self, other: &Rhs) -> bool {
1424        self.partial_cmp(other).is_some_and(Ordering::is_gt)
1425    }
1426
1427    #[inline]
1438    #[must_use]
1439    #[stable(feature = "rust1", since = "1.0.0")]
1440    #[rustc_diagnostic_item = "cmp_partialord_ge"]
1441    fn ge(&self, other: &Rhs) -> bool {
1442        self.partial_cmp(other).is_some_and(Ordering::is_ge)
1443    }
1444
1445    #[inline]
1453    #[unstable(feature = "partial_ord_chaining_methods", issue = "none")]
1455    #[doc(hidden)]
1456    fn __chaining_lt(&self, other: &Rhs) -> ControlFlow<bool> {
1457        default_chaining_impl(self, other, Ordering::is_lt)
1458    }
1459
1460    #[inline]
1462    #[unstable(feature = "partial_ord_chaining_methods", issue = "none")]
1463    #[doc(hidden)]
1464    fn __chaining_le(&self, other: &Rhs) -> ControlFlow<bool> {
1465        default_chaining_impl(self, other, Ordering::is_le)
1466    }
1467
1468    #[inline]
1470    #[unstable(feature = "partial_ord_chaining_methods", issue = "none")]
1471    #[doc(hidden)]
1472    fn __chaining_gt(&self, other: &Rhs) -> ControlFlow<bool> {
1473        default_chaining_impl(self, other, Ordering::is_gt)
1474    }
1475
1476    #[inline]
1478    #[unstable(feature = "partial_ord_chaining_methods", issue = "none")]
1479    #[doc(hidden)]
1480    fn __chaining_ge(&self, other: &Rhs) -> ControlFlow<bool> {
1481        default_chaining_impl(self, other, Ordering::is_ge)
1482    }
1483}
1484
1485fn default_chaining_impl<T, U>(
1486    lhs: &T,
1487    rhs: &U,
1488    p: impl FnOnce(Ordering) -> bool,
1489) -> ControlFlow<bool>
1490where
1491    T: PartialOrd<U> + PointeeSized,
1492    U: PointeeSized,
1493{
1494    match <T as PartialOrd<U>>::partial_cmp(lhs, rhs) {
1498        Some(Equal) => ControlFlow::Continue(()),
1499        Some(c) => ControlFlow::Break(p(c)),
1500        None => ControlFlow::Break(false),
1501    }
1502}
1503
1504#[rustc_builtin_macro]
1507#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
1508#[allow_internal_unstable(core_intrinsics)]
1509pub macro PartialOrd($item:item) {
1510    }
1512
1513#[inline]
1546#[must_use]
1547#[stable(feature = "rust1", since = "1.0.0")]
1548#[rustc_diagnostic_item = "cmp_min"]
1549pub fn min<T: Ord>(v1: T, v2: T) -> T {
1550    v1.min(v2)
1551}
1552
1553#[inline]
1574#[must_use]
1575#[stable(feature = "cmp_min_max_by", since = "1.53.0")]
1576pub fn min_by<T, F: FnOnce(&T, &T) -> Ordering>(v1: T, v2: T, compare: F) -> T {
1577    if compare(&v2, &v1).is_lt() { v2 } else { v1 }
1578}
1579
1580#[inline]
1599#[must_use]
1600#[stable(feature = "cmp_min_max_by", since = "1.53.0")]
1601pub fn min_by_key<T, F: FnMut(&T) -> K, K: Ord>(v1: T, v2: T, mut f: F) -> T {
1602    if f(&v2) < f(&v1) { v2 } else { v1 }
1603}
1604
1605#[inline]
1638#[must_use]
1639#[stable(feature = "rust1", since = "1.0.0")]
1640#[rustc_diagnostic_item = "cmp_max"]
1641pub fn max<T: Ord>(v1: T, v2: T) -> T {
1642    v1.max(v2)
1643}
1644
1645#[inline]
1666#[must_use]
1667#[stable(feature = "cmp_min_max_by", since = "1.53.0")]
1668pub fn max_by<T, F: FnOnce(&T, &T) -> Ordering>(v1: T, v2: T, compare: F) -> T {
1669    if compare(&v2, &v1).is_lt() { v1 } else { v2 }
1670}
1671
1672#[inline]
1691#[must_use]
1692#[stable(feature = "cmp_min_max_by", since = "1.53.0")]
1693pub fn max_by_key<T, F: FnMut(&T) -> K, K: Ord>(v1: T, v2: T, mut f: F) -> T {
1694    if f(&v2) < f(&v1) { v1 } else { v2 }
1695}
1696
1697#[inline]
1735#[must_use]
1736#[unstable(feature = "cmp_minmax", issue = "115939")]
1737pub fn minmax<T>(v1: T, v2: T) -> [T; 2]
1738where
1739    T: Ord,
1740{
1741    if v2 < v1 { [v2, v1] } else { [v1, v2] }
1742}
1743
1744#[inline]
1766#[must_use]
1767#[unstable(feature = "cmp_minmax", issue = "115939")]
1768pub fn minmax_by<T, F>(v1: T, v2: T, compare: F) -> [T; 2]
1769where
1770    F: FnOnce(&T, &T) -> Ordering,
1771{
1772    if compare(&v2, &v1).is_lt() { [v2, v1] } else { [v1, v2] }
1773}
1774
1775#[inline]
1794#[must_use]
1795#[unstable(feature = "cmp_minmax", issue = "115939")]
1796pub fn minmax_by_key<T, F, K>(v1: T, v2: T, mut f: F) -> [T; 2]
1797where
1798    F: FnMut(&T) -> K,
1799    K: Ord,
1800{
1801    if f(&v2) < f(&v1) { [v2, v1] } else { [v1, v2] }
1802}
1803
1804mod impls {
1806    use crate::cmp::Ordering::{self, Equal, Greater, Less};
1807    use crate::hint::unreachable_unchecked;
1808    use crate::marker::PointeeSized;
1809    use crate::ops::ControlFlow::{self, Break, Continue};
1810
1811    macro_rules! partial_eq_impl {
1812        ($($t:ty)*) => ($(
1813            #[stable(feature = "rust1", since = "1.0.0")]
1814            #[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
1815            impl const PartialEq for $t {
1816                #[inline]
1817                fn eq(&self, other: &Self) -> bool { *self == *other }
1818                #[inline]
1819                fn ne(&self, other: &Self) -> bool { *self != *other }
1820            }
1821        )*)
1822    }
1823
1824    #[stable(feature = "rust1", since = "1.0.0")]
1825    impl PartialEq for () {
1826        #[inline]
1827        fn eq(&self, _other: &()) -> bool {
1828            true
1829        }
1830        #[inline]
1831        fn ne(&self, _other: &()) -> bool {
1832            false
1833        }
1834    }
1835
1836    partial_eq_impl! {
1837        bool char usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f16 f32 f64 f128
1838    }
1839
1840    macro_rules! eq_impl {
1841        ($($t:ty)*) => ($(
1842            #[stable(feature = "rust1", since = "1.0.0")]
1843            impl Eq for $t {}
1844        )*)
1845    }
1846
1847    eq_impl! { () bool char usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
1848
1849    #[rustfmt::skip]
1850    macro_rules! partial_ord_methods_primitive_impl {
1851        () => {
1852            #[inline(always)]
1853            fn lt(&self, other: &Self) -> bool { *self <  *other }
1854            #[inline(always)]
1855            fn le(&self, other: &Self) -> bool { *self <= *other }
1856            #[inline(always)]
1857            fn gt(&self, other: &Self) -> bool { *self >  *other }
1858            #[inline(always)]
1859            fn ge(&self, other: &Self) -> bool { *self >= *other }
1860
1861            #[inline]
1866            fn __chaining_lt(&self, other: &Self) -> ControlFlow<bool> {
1867                let (lhs, rhs) = (*self, *other);
1868                if lhs == rhs { Continue(()) } else { Break(lhs < rhs) }
1869            }
1870            #[inline]
1871            fn __chaining_le(&self, other: &Self) -> ControlFlow<bool> {
1872                let (lhs, rhs) = (*self, *other);
1873                if lhs == rhs { Continue(()) } else { Break(lhs <= rhs) }
1874            }
1875            #[inline]
1876            fn __chaining_gt(&self, other: &Self) -> ControlFlow<bool> {
1877                let (lhs, rhs) = (*self, *other);
1878                if lhs == rhs { Continue(()) } else { Break(lhs > rhs) }
1879            }
1880            #[inline]
1881            fn __chaining_ge(&self, other: &Self) -> ControlFlow<bool> {
1882                let (lhs, rhs) = (*self, *other);
1883                if lhs == rhs { Continue(()) } else { Break(lhs >= rhs) }
1884            }
1885        };
1886    }
1887
1888    macro_rules! partial_ord_impl {
1889        ($($t:ty)*) => ($(
1890            #[stable(feature = "rust1", since = "1.0.0")]
1891            impl PartialOrd for $t {
1892                #[inline]
1893                fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
1894                    match (*self <= *other, *self >= *other) {
1895                        (false, false) => None,
1896                        (false, true) => Some(Greater),
1897                        (true, false) => Some(Less),
1898                        (true, true) => Some(Equal),
1899                    }
1900                }
1901
1902                partial_ord_methods_primitive_impl!();
1903            }
1904        )*)
1905    }
1906
1907    #[stable(feature = "rust1", since = "1.0.0")]
1908    impl PartialOrd for () {
1909        #[inline]
1910        fn partial_cmp(&self, _: &()) -> Option<Ordering> {
1911            Some(Equal)
1912        }
1913    }
1914
1915    #[stable(feature = "rust1", since = "1.0.0")]
1916    impl PartialOrd for bool {
1917        #[inline]
1918        fn partial_cmp(&self, other: &bool) -> Option<Ordering> {
1919            Some(self.cmp(other))
1920        }
1921
1922        partial_ord_methods_primitive_impl!();
1923    }
1924
1925    partial_ord_impl! { f16 f32 f64 f128 }
1926
1927    macro_rules! ord_impl {
1928        ($($t:ty)*) => ($(
1929            #[stable(feature = "rust1", since = "1.0.0")]
1930            impl PartialOrd for $t {
1931                #[inline]
1932                fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
1933                    Some(crate::intrinsics::three_way_compare(*self, *other))
1934                }
1935
1936                partial_ord_methods_primitive_impl!();
1937            }
1938
1939            #[stable(feature = "rust1", since = "1.0.0")]
1940            impl Ord for $t {
1941                #[inline]
1942                fn cmp(&self, other: &Self) -> Ordering {
1943                    crate::intrinsics::three_way_compare(*self, *other)
1944                }
1945            }
1946        )*)
1947    }
1948
1949    #[stable(feature = "rust1", since = "1.0.0")]
1950    impl Ord for () {
1951        #[inline]
1952        fn cmp(&self, _other: &()) -> Ordering {
1953            Equal
1954        }
1955    }
1956
1957    #[stable(feature = "rust1", since = "1.0.0")]
1958    impl Ord for bool {
1959        #[inline]
1960        fn cmp(&self, other: &bool) -> Ordering {
1961            match (*self as i8) - (*other as i8) {
1965                -1 => Less,
1966                0 => Equal,
1967                1 => Greater,
1968                _ => unsafe { unreachable_unchecked() },
1970            }
1971        }
1972
1973        #[inline]
1974        fn min(self, other: bool) -> bool {
1975            self & other
1976        }
1977
1978        #[inline]
1979        fn max(self, other: bool) -> bool {
1980            self | other
1981        }
1982
1983        #[inline]
1984        fn clamp(self, min: bool, max: bool) -> bool {
1985            assert!(min <= max);
1986            self.max(min).min(max)
1987        }
1988    }
1989
1990    ord_impl! { char usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
1991
1992    #[unstable(feature = "never_type", issue = "35121")]
1993    impl PartialEq for ! {
1994        #[inline]
1995        fn eq(&self, _: &!) -> bool {
1996            *self
1997        }
1998    }
1999
2000    #[unstable(feature = "never_type", issue = "35121")]
2001    impl Eq for ! {}
2002
2003    #[unstable(feature = "never_type", issue = "35121")]
2004    impl PartialOrd for ! {
2005        #[inline]
2006        fn partial_cmp(&self, _: &!) -> Option<Ordering> {
2007            *self
2008        }
2009    }
2010
2011    #[unstable(feature = "never_type", issue = "35121")]
2012    impl Ord for ! {
2013        #[inline]
2014        fn cmp(&self, _: &!) -> Ordering {
2015            *self
2016        }
2017    }
2018
2019    #[stable(feature = "rust1", since = "1.0.0")]
2022    #[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
2023    impl<A: PointeeSized, B: PointeeSized> const PartialEq<&B> for &A
2024    where
2025        A: [const] PartialEq<B>,
2026    {
2027        #[inline]
2028        fn eq(&self, other: &&B) -> bool {
2029            PartialEq::eq(*self, *other)
2030        }
2031        #[inline]
2032        fn ne(&self, other: &&B) -> bool {
2033            PartialEq::ne(*self, *other)
2034        }
2035    }
2036    #[stable(feature = "rust1", since = "1.0.0")]
2037    impl<A: PointeeSized, B: PointeeSized> PartialOrd<&B> for &A
2038    where
2039        A: PartialOrd<B>,
2040    {
2041        #[inline]
2042        fn partial_cmp(&self, other: &&B) -> Option<Ordering> {
2043            PartialOrd::partial_cmp(*self, *other)
2044        }
2045        #[inline]
2046        fn lt(&self, other: &&B) -> bool {
2047            PartialOrd::lt(*self, *other)
2048        }
2049        #[inline]
2050        fn le(&self, other: &&B) -> bool {
2051            PartialOrd::le(*self, *other)
2052        }
2053        #[inline]
2054        fn gt(&self, other: &&B) -> bool {
2055            PartialOrd::gt(*self, *other)
2056        }
2057        #[inline]
2058        fn ge(&self, other: &&B) -> bool {
2059            PartialOrd::ge(*self, *other)
2060        }
2061        #[inline]
2062        fn __chaining_lt(&self, other: &&B) -> ControlFlow<bool> {
2063            PartialOrd::__chaining_lt(*self, *other)
2064        }
2065        #[inline]
2066        fn __chaining_le(&self, other: &&B) -> ControlFlow<bool> {
2067            PartialOrd::__chaining_le(*self, *other)
2068        }
2069        #[inline]
2070        fn __chaining_gt(&self, other: &&B) -> ControlFlow<bool> {
2071            PartialOrd::__chaining_gt(*self, *other)
2072        }
2073        #[inline]
2074        fn __chaining_ge(&self, other: &&B) -> ControlFlow<bool> {
2075            PartialOrd::__chaining_ge(*self, *other)
2076        }
2077    }
2078    #[stable(feature = "rust1", since = "1.0.0")]
2079    impl<A: PointeeSized> Ord for &A
2080    where
2081        A: Ord,
2082    {
2083        #[inline]
2084        fn cmp(&self, other: &Self) -> Ordering {
2085            Ord::cmp(*self, *other)
2086        }
2087    }
2088    #[stable(feature = "rust1", since = "1.0.0")]
2089    impl<A: PointeeSized> Eq for &A where A: Eq {}
2090
2091    #[stable(feature = "rust1", since = "1.0.0")]
2094    #[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
2095    impl<A: PointeeSized, B: PointeeSized> const PartialEq<&mut B> for &mut A
2096    where
2097        A: [const] PartialEq<B>,
2098    {
2099        #[inline]
2100        fn eq(&self, other: &&mut B) -> bool {
2101            PartialEq::eq(*self, *other)
2102        }
2103        #[inline]
2104        fn ne(&self, other: &&mut B) -> bool {
2105            PartialEq::ne(*self, *other)
2106        }
2107    }
2108    #[stable(feature = "rust1", since = "1.0.0")]
2109    impl<A: PointeeSized, B: PointeeSized> PartialOrd<&mut B> for &mut A
2110    where
2111        A: PartialOrd<B>,
2112    {
2113        #[inline]
2114        fn partial_cmp(&self, other: &&mut B) -> Option<Ordering> {
2115            PartialOrd::partial_cmp(*self, *other)
2116        }
2117        #[inline]
2118        fn lt(&self, other: &&mut B) -> bool {
2119            PartialOrd::lt(*self, *other)
2120        }
2121        #[inline]
2122        fn le(&self, other: &&mut B) -> bool {
2123            PartialOrd::le(*self, *other)
2124        }
2125        #[inline]
2126        fn gt(&self, other: &&mut B) -> bool {
2127            PartialOrd::gt(*self, *other)
2128        }
2129        #[inline]
2130        fn ge(&self, other: &&mut B) -> bool {
2131            PartialOrd::ge(*self, *other)
2132        }
2133        #[inline]
2134        fn __chaining_lt(&self, other: &&mut B) -> ControlFlow<bool> {
2135            PartialOrd::__chaining_lt(*self, *other)
2136        }
2137        #[inline]
2138        fn __chaining_le(&self, other: &&mut B) -> ControlFlow<bool> {
2139            PartialOrd::__chaining_le(*self, *other)
2140        }
2141        #[inline]
2142        fn __chaining_gt(&self, other: &&mut B) -> ControlFlow<bool> {
2143            PartialOrd::__chaining_gt(*self, *other)
2144        }
2145        #[inline]
2146        fn __chaining_ge(&self, other: &&mut B) -> ControlFlow<bool> {
2147            PartialOrd::__chaining_ge(*self, *other)
2148        }
2149    }
2150    #[stable(feature = "rust1", since = "1.0.0")]
2151    impl<A: PointeeSized> Ord for &mut A
2152    where
2153        A: Ord,
2154    {
2155        #[inline]
2156        fn cmp(&self, other: &Self) -> Ordering {
2157            Ord::cmp(*self, *other)
2158        }
2159    }
2160    #[stable(feature = "rust1", since = "1.0.0")]
2161    impl<A: PointeeSized> Eq for &mut A where A: Eq {}
2162
2163    #[stable(feature = "rust1", since = "1.0.0")]
2164    #[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
2165    impl<A: PointeeSized, B: PointeeSized> const PartialEq<&mut B> for &A
2166    where
2167        A: [const] PartialEq<B>,
2168    {
2169        #[inline]
2170        fn eq(&self, other: &&mut B) -> bool {
2171            PartialEq::eq(*self, *other)
2172        }
2173        #[inline]
2174        fn ne(&self, other: &&mut B) -> bool {
2175            PartialEq::ne(*self, *other)
2176        }
2177    }
2178
2179    #[stable(feature = "rust1", since = "1.0.0")]
2180    #[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
2181    impl<A: PointeeSized, B: PointeeSized> const PartialEq<&B> for &mut A
2182    where
2183        A: [const] PartialEq<B>,
2184    {
2185        #[inline]
2186        fn eq(&self, other: &&B) -> bool {
2187            PartialEq::eq(*self, *other)
2188        }
2189        #[inline]
2190        fn ne(&self, other: &&B) -> bool {
2191            PartialEq::ne(*self, *other)
2192        }
2193    }
2194}

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4