mirror of
https://github.com/servo/servo.git
synced 2025-07-16 03:43:38 +01:00
Implement Hash and Eq for JS<T> and LayoutJS<T>.
This commit is contained in:
parent
98dc67dbec
commit
630b9f8fa0
1 changed files with 13 additions and 0 deletions
|
@ -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<T> PartialEq for JS<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T> Eq for JS<T> {}
|
||||
|
||||
impl<T> PartialEq for LayoutJS<T> {
|
||||
fn eq(&self, other: &LayoutJS<T>) -> bool {
|
||||
self.ptr == other.ptr
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Eq for LayoutJS<T> {}
|
||||
|
||||
impl<T> Hash for JS<T> {
|
||||
fn hash<H: Hasher>(&self, state: &mut H) { self.ptr.hash(state) }
|
||||
}
|
||||
|
||||
impl<T> Hash for LayoutJS<T> {
|
||||
fn hash<H: Hasher>(&self, state: &mut H) { self.ptr.hash(state) }
|
||||
}
|
||||
|
||||
impl <T> Clone for JS<T> {
|
||||
#[inline]
|
||||
#[allow(unrooted_must_root)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue