mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Derive DomObject with a proc macro
This commit is contained in:
parent
1dfdd0bab8
commit
c84cea995b
9 changed files with 92 additions and 91 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue