Add LayoutJS<T: Reflectable>.get_jsobject().

This commit is contained in:
Tetsuharu OHZEKI 2015-01-31 18:17:15 +09:00
parent b7443bef83
commit 2cca095481
2 changed files with 9 additions and 12 deletions

View file

@ -144,6 +144,13 @@ pub struct LayoutJS<T> {
ptr: NonZero<*const T>
}
impl<T: Reflectable> LayoutJS<T> {
/// Get the reflector.
pub unsafe fn get_jsobject(&self) -> *mut JSObject {
(**self.ptr).reflector().get_jsobject()
}
}
impl<T> Copy for JS<T> {}
impl<T> Copy for LayoutJS<T> {}
@ -241,15 +248,6 @@ impl<T: Reflectable> Reflectable for JS<T> {
}
}
// XXXjdm same above
impl<T: Reflectable> Reflectable for LayoutJS<T> {
fn reflector<'a>(&'a self) -> &'a Reflector {
unsafe {
(*self.unsafe_get()).reflector()
}
}
}
/// A trait to be implemented for JS-managed types that can be stored in
/// mutable member fields.
///