mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Stop requiring that the type argument to RootedVec implements Reflectable.
It is sufficient that it implements JSTraceable.
This commit is contained in:
parent
b05f4aa3aa
commit
ca5e7097a0
1 changed files with 6 additions and 8 deletions
|
@ -455,19 +455,17 @@ impl<'a, T: JSTraceable> Drop for RootedTraceable<'a, T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A vector of items that are rooted for the lifetime
|
/// A vector of items that are rooted for the lifetime of this struct.
|
||||||
/// of this struct.
|
|
||||||
/// Must be a reflectable
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
#[no_move]
|
#[no_move]
|
||||||
#[derive(JSTraceable)]
|
#[derive(JSTraceable)]
|
||||||
#[allow_unrooted_interior]
|
#[allow_unrooted_interior]
|
||||||
pub struct RootedVec<T: JSTraceable + Reflectable> {
|
pub struct RootedVec<T: JSTraceable> {
|
||||||
v: Vec<T>
|
v: Vec<T>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl<T: JSTraceable + Reflectable> RootedVec<T> {
|
impl<T: JSTraceable> RootedVec<T> {
|
||||||
/// Create a vector of items of type T that is rooted for
|
/// Create a vector of items of type T that is rooted for
|
||||||
/// the lifetime of this struct
|
/// the lifetime of this struct
|
||||||
pub fn new() -> RootedVec<T> {
|
pub fn new() -> RootedVec<T> {
|
||||||
|
@ -495,20 +493,20 @@ impl<T: JSTraceable + Reflectable> RootedVec<JS<T>> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: JSTraceable + Reflectable> Drop for RootedVec<T> {
|
impl<T: JSTraceable> Drop for RootedVec<T> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
RootedTraceableSet::remove(self);
|
RootedTraceableSet::remove(self);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: JSTraceable + Reflectable> Deref for RootedVec<T> {
|
impl<T: JSTraceable> Deref for RootedVec<T> {
|
||||||
type Target = Vec<T>;
|
type Target = Vec<T>;
|
||||||
fn deref(&self) -> &Vec<T> {
|
fn deref(&self) -> &Vec<T> {
|
||||||
&self.v
|
&self.v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: JSTraceable + Reflectable> DerefMut for RootedVec<T> {
|
impl<T: JSTraceable> DerefMut for RootedVec<T> {
|
||||||
fn deref_mut(&mut self) -> &mut Vec<T> {
|
fn deref_mut(&mut self) -> &mut Vec<T> {
|
||||||
&mut self.v
|
&mut self.v
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue