Skip to content

Commit

Permalink
implement PartialEq for MutHeap<JS<T>> and MutNullableHeap<JS<T>>
Browse files Browse the repository at this point in the history
  • Loading branch information
ajnirp committed Oct 20, 2015
1 parent 36d5c0b commit ab70c8c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions components/script/dom/bindings/js.rs
Expand Up @@ -260,6 +260,12 @@ impl<T: HeapGCValue> HeapSizeOf for MutHeap<T> {
}
}

impl<T: Reflectable> PartialEq for MutHeap<JS<T>> {
fn eq(&self, other: &MutHeap<JS<T>>) -> bool {
self.get().eq(&other.get())
}
}

/// A holder that provides interior mutability for GC-managed values such as
/// `JS<T>`, with nullability represented by an enclosing Option wrapper.
/// Essentially a `Cell<Option<JS<T>>>`, but safer.
Expand Down Expand Up @@ -337,6 +343,12 @@ impl<T: HeapGCValue> HeapSizeOf for MutNullableHeap<T> {
}
}

impl<T: Reflectable> PartialEq for MutNullableHeap<JS<T>> {
fn eq(&self, other: &MutNullableHeap<JS<T>>) -> bool {
self.get().eq(&other.get())
}
}

impl<T: Reflectable> LayoutJS<T> {
/// Returns an unsafe pointer to the interior of this JS object. This is
/// the only method that be safely accessed from layout. (The fact that
Expand Down

0 comments on commit ab70c8c

Please sign in to comment.