Add untraceable! macro

This commit is contained in:
Manish Goregaokar 2014-09-24 01:15:57 +05:30
parent 3b7e07699e
commit 85f79290a6
3 changed files with 22 additions and 1 deletions

View file

@ -33,7 +33,9 @@ use js::jsapi::{JSObject, JSTracer, JS_CallTracer, JSTRACE_OBJECT};
use js::jsval::JSVal; use js::jsval::JSVal;
use libc; use libc;
use url::Url;
use std::mem; use std::mem;
use std::num;
use std::cell::{Cell, RefCell}; use std::cell::{Cell, RefCell};
use serialize::{Encodable, Encoder}; use serialize::{Encodable, Encoder};

View file

@ -42,3 +42,19 @@ macro_rules! make_uint_getter(
} }
); );
) )
/// For use on non-jsmanaged types
/// Use #[jstraceable] on JS managed types
macro_rules! untraceable(
($($ty:ident),+) => (
$(
impl JSTraceable for $ty {
#[inline]
fn trace(&self, _: *mut JSTracer) {
// Do nothing
}
}
)+
);
)

View file

@ -45,7 +45,11 @@ extern crate uuid;
pub mod cors; pub mod cors;
/// The implementation of the DOM. /// The implementation of the DOM.
#[macro_escape]
pub mod dom { pub mod dom {
#[macro_escape]
pub mod macros;
/// The code to expose the DOM to JavaScript through IDL bindings. /// The code to expose the DOM to JavaScript through IDL bindings.
pub mod bindings { pub mod bindings {
pub mod global; pub mod global;
@ -72,7 +76,6 @@ pub mod dom {
#[path="bindings/codegen/InterfaceTypes.rs"] #[path="bindings/codegen/InterfaceTypes.rs"]
pub mod types; pub mod types;
pub mod macros;
pub mod attr; pub mod attr;
pub mod blob; pub mod blob;