mirror of
https://github.com/servo/servo
synced 2026-04-30 19:37:43 +02:00
Derive DomObject with a proc macro
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user