summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-02-27 21:46:53 -0800
committerbors <bors@rust-lang.org>2014-02-27 21:46:53 -0800
commitf203fc7daf8d598a7eacee1a135f2fd92dc6382e (patch)
treed9519b932dd81fc44b4290554a7722d729d1fdc2 /src/libstd
parent700fd35fb9d448c5e1658c3cec9c1153c57cc802 (diff)
parent4da6d041c268d58654d54b317288c940e5c623fd (diff)
downloadrust-f203fc7daf8d598a7eacee1a135f2fd92dc6382e.tar.gz
rust-f203fc7daf8d598a7eacee1a135f2fd92dc6382e.zip
auto merge of #12348 : brunoabinader/rust/libcollections-list-refactory, r=alexcrichton
This PR includes:
- Create an iterator for ```List<T>``` called ```Items<T>```;
- Move all list operations inside ```List<T>``` impl;
- Removed functions that are already provided by ```Iterator``` trait;
- Refactor on ```len()``` and ```is_empty``` using ```Container``` trait;
- Bunch of minor fixes;

A replacement for using @ is intended, but still in discussion.

Closes #12344.
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/cell.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libstd/cell.rs b/src/libstd/cell.rs
index 0a3c87f4058..bc28f2f445e 100644
--- a/src/libstd/cell.rs
+++ b/src/libstd/cell.rs
@@ -55,6 +55,12 @@ impl<T:Pod> Clone for Cell<T> {
     }
 }
 
+impl<T:Eq + Pod> Eq for Cell<T> {
+    fn eq(&self, other: &Cell<T>) -> bool {
+        self.get() == other.get()
+    }
+}
+
 /// A mutable memory location with dynamically checked borrow rules
 pub struct RefCell<T> {
     priv value: T,
@@ -273,11 +279,14 @@ mod test {
     #[test]
     fn smoketest_cell() {
         let x = Cell::new(10);
+        assert_eq!(x, Cell::new(10));
         assert_eq!(x.get(), 10);
         x.set(20);
+        assert_eq!(x, Cell::new(20));
         assert_eq!(x.get(), 20);
 
         let y = Cell::new((30, 40));
+        assert_eq!(y, Cell::new((30, 40)));
         assert_eq!(y.get(), (30, 40));
     }