Add a static from_rooted method to JS<T> #2309

This commit is contained in:
Edit Balint 2014-06-02 15:48:19 +02:00
parent 59cef940e8
commit 7910eb1399

View file

@ -166,6 +166,14 @@ impl<T: Reflectable> JS<T> {
}
}
impl<T: Assignable<U>, U: Reflectable> JS<U> {
pub fn from_rooted(root: T) -> JS<U> {
unsafe {
root.get_js()
}
}
}
//XXXjdm This is disappointing. This only gets called from trace hooks, in theory,
// so it's safe to assume that self is rooted and thereby safe to access.
impl<T: Reflectable> Reflectable for JS<T> {