Derive DomObject with a proc macro

This commit is contained in:
Anthony Ramine 2017-02-14 14:13:43 +01:00
parent 1dfdd0bab8
commit c84cea995b
9 changed files with 92 additions and 91 deletions

View file

@ -83,8 +83,20 @@ pub trait DomObject {
}
}
impl DomObject for Reflector {
fn reflector(&self) -> &Self {
self
}
}
/// A trait to initialize the `Reflector` for a DOM object.
pub trait MutDomObject: DomObject {
/// Initializes the Reflector
fn init_reflector(&mut self, obj: *mut JSObject);
}
impl MutDomObject for Reflector {
fn init_reflector(&mut self, obj: *mut JSObject) {
self.set_jsobject(obj)
}
}