1 // Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 //! Utilities for references
14 use cmp::{Eq, Ord, Ordering, TotalEq, TotalOrd};
16 // Equality for region pointers
18 impl<'a, T: Eq> Eq for &'a T {
20 fn eq(&self, other: & &'a T) -> bool {
24 fn ne(&self, other: & &'a T) -> bool {
29 // Comparison for region pointers
31 impl<'a, T: Ord> Ord for &'a T {
33 fn lt(&self, other: & &'a T) -> bool {
37 fn le(&self, other: & &'a T) -> bool {
41 fn ge(&self, other: & &'a T) -> bool {
45 fn gt(&self, other: & &'a T) -> bool {
51 impl<'a, T: TotalOrd> TotalOrd for &'a T {
53 fn cmp(&self, other: & &'a T) -> Ordering { (**self).cmp(*other) }
57 impl<'a, T: TotalEq> TotalEq for &'a T {}