Use global exports from derives (#33169)

* pub reexport *Traceable

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* reexport `HasParent` for derives

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* reexport DomObject, Reflector, MutDomObject

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* fmt

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Update lib.rs

Signed-off-by: Samson <16504129+sagudev@users.noreply.github.com>

* Update lib.rs

Signed-off-by: Samson <16504129+sagudev@users.noreply.github.com>

* Update lib.rs

Signed-off-by: Samson <16504129+sagudev@users.noreply.github.com>

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Signed-off-by: Samson <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
Samson 2024-08-25 15:58:09 +02:00 committed by GitHub
parent 6357998ede
commit 88d8770214
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 23 additions and 15 deletions

View file

@ -40,19 +40,19 @@ fn expand_dom_object(input: syn::DeriveInput) -> proc_macro2::TokenStream {
unsafe fn to_jsval(&self,
cx: *mut js::jsapi::JSContext,
rval: js::rust::MutableHandleValue) {
let object = crate::dom::bindings::reflector::DomObject::reflector(self).get_jsobject();
let object = crate::DomObject::reflector(self).get_jsobject();
object.to_jsval(cx, rval)
}
}
impl #impl_generics crate::dom::bindings::reflector::DomObject for #name #ty_generics #where_clause {
impl #impl_generics crate::DomObject for #name #ty_generics #where_clause {
#[inline]
fn reflector(&self) -> &crate::dom::bindings::reflector::Reflector {
fn reflector(&self) -> &crate::Reflector {
self.#first_field_name.reflector()
}
}
impl #impl_generics crate::dom::bindings::reflector::MutDomObject for #name #ty_generics #where_clause {
impl #impl_generics crate::MutDomObject for #name #ty_generics #where_clause {
unsafe fn init_reflector(&self, obj: *mut js::jsapi::JSObject) {
self.#first_field_name.init_reflector(obj);
}
@ -74,7 +74,7 @@ fn expand_dom_object(input: syn::DeriveInput) -> proc_macro2::TokenStream {
let mut generics = input.generics.clone();
generics.params.push(parse_quote!(
__T: crate::dom::bindings::reflector::DomObject
__T: crate::DomObject
));
let (impl_generics, _, where_clause) = generics.split_for_impl();