Stop requiring that the type argument to RootedVec implements Reflectable.

It is sufficient that it implements JSTraceable.
This commit is contained in:
Ms2ger 2015-09-13 16:43:28 +02:00
parent b05f4aa3aa
commit ca5e7097a0

View file

@ -455,19 +455,17 @@ impl<'a, T: JSTraceable> Drop for RootedTraceable<'a, T> {
}
}
/// A vector of items that are rooted for the lifetime
/// of this struct.
/// Must be a reflectable
/// A vector of items that are rooted for the lifetime of this struct.
#[allow(unrooted_must_root)]
#[no_move]
#[derive(JSTraceable)]
#[allow_unrooted_interior]
pub struct RootedVec<T: JSTraceable + Reflectable> {
pub struct RootedVec<T: JSTraceable> {
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
/// the lifetime of this struct
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) {
RootedTraceableSet::remove(self);
}
}
impl<T: JSTraceable + Reflectable> Deref for RootedVec<T> {
impl<T: JSTraceable> Deref for RootedVec<T> {
type Target = Vec<T>;
fn deref(&self) -> &Vec<T> {
&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> {
&mut self.v
}