We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1e6151a commit 8846970Copy full SHA for 8846970
src/libstd/cell.rs
@@ -55,6 +55,12 @@ impl<T:Pod> Clone for Cell<T> {
55
}
56
57
58
+impl<T:Eq + Pod> Eq for Cell<T> {
59
+ fn eq(&self, other: &Cell<T>) -> bool {
60
+ self.get() == other.get()
61
+ }
62
+}
63
+
64
/// A mutable memory location with dynamically checked borrow rules
65
pub struct RefCell<T> {
66
priv value: T,
@@ -273,11 +279,14 @@ mod test {
273
279
#[test]
274
280
fn smoketest_cell() {
275
281
let x = Cell::new(10);
282
+ assert_eq!(x, Cell::new(10));
276
283
assert_eq!(x.get(), 10);
277
284
x.set(20);
285
+ assert_eq!(x, Cell::new(20));
278
286
assert_eq!(x.get(), 20);
287
288
let y = Cell::new((30, 40));
289
+ assert_eq!(y, Cell::new((30, 40)));
290
assert_eq!(y.get(), (30, 40));
291
292
0 commit comments