From 630b9f8fa0b953838b1778a3eca331c7e970cbc9 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Fri, 9 Oct 2015 21:01:38 -0700 Subject: [PATCH] Implement Hash and Eq for JS and LayoutJS. --- components/script/dom/bindings/js.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/components/script/dom/bindings/js.rs b/components/script/dom/bindings/js.rs index a2ec90033ba..9a4f17b426a 100644 --- a/components/script/dom/bindings/js.rs +++ b/components/script/dom/bindings/js.rs @@ -35,6 +35,7 @@ use layout_interface::TrustedNodeAddress; use script_task::STACK_ROOTS; use std::cell::UnsafeCell; use std::default::Default; +use std::hash::{Hash, Hasher}; use std::mem; use std::ops::Deref; use std::ptr; @@ -147,12 +148,24 @@ impl PartialEq for JS { } } +impl Eq for JS {} + impl PartialEq for LayoutJS { fn eq(&self, other: &LayoutJS) -> bool { self.ptr == other.ptr } } +impl Eq for LayoutJS {} + +impl Hash for JS { + fn hash(&self, state: &mut H) { self.ptr.hash(state) } +} + +impl Hash for LayoutJS { + fn hash(&self, state: &mut H) { self.ptr.hash(state) } +} + impl Clone for JS { #[inline] #[allow(unrooted_must_root)]