mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01: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
|
@ -36,6 +36,7 @@ caseless = "0.1.0"
|
|||
cookie = {version = "0.2.5", features = ["serialize-rustc"]}
|
||||
cssparser = {version = "0.7", features = ["heap_size", "serde-serialization"]}
|
||||
devtools_traits = {path = "../devtools_traits"}
|
||||
domobject_derive = {path = "../domobject_derive"}
|
||||
encoding = "0.2"
|
||||
euclid = "0.10.1"
|
||||
fnv = "1.0"
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,8 @@ extern crate core;
|
|||
#[macro_use]
|
||||
extern crate cssparser;
|
||||
extern crate devtools_traits;
|
||||
#[macro_use]
|
||||
extern crate domobject_derive;
|
||||
extern crate encoding;
|
||||
extern crate euclid;
|
||||
extern crate fnv;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue