diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2012-08-27 17:33:22 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2012-08-27 17:33:22 -0700 |
| commit | 9c04454e7bb4aeb6592bc0164fce182d0a83e754 (patch) | |
| tree | 120d5390467edef0a7f26c0938c27532f0ffb798 | |
| parent | 5792244d03149fafdf65fc1bbc05b24323fbfa1a (diff) | |
libcore: Implement equality for pointers
| -rw-r--r-- | src/libcore/ptr.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 5dcd0a52724..0a2ffd1d904 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -18,6 +18,7 @@ export buf_len; export position; export Ptr; +import cmp::Eq; import libc::{c_void, size_t}; #[nolink] @@ -170,6 +171,11 @@ impl<T> *T: Ptr { pure fn is_not_null() -> bool { is_not_null(self) } } +// Equality for pointers +impl<T: Eq> *T : Eq { + pure fn eq(&&other: *T) -> bool { self == other } +} + #[test] fn test() { unsafe { |
