Skip to content

Instantly share code, notes, and snippets.

@larsbergstrom
Created April 22, 2014 00:58
Show Gist options
  • Select an option

  • Save larsbergstrom/11161846 to your computer and use it in GitHub Desktop.

Select an option

Save larsbergstrom/11161846 to your computer and use it in GitHub Desktop.
/Users/larsberg/servo/src/components/script/dom/bindings/codegen/EventListenerBinding.rs:72:3: 72:28 error: expected serialize::serialize::Encoder<()>, but found serialize::serialize::Encoder<__E> (expected () but found type parameter)
/Users/larsberg/servo/src/components/script/dom/bindings/codegen/EventListenerBinding.rs:72 parent: CallbackInterface,
^~~~~~~~~~~~~~~~~~~~~~~~~
note: in expansion of #[deriving]
@larsbergstrom

Copy link
Copy Markdown
Author
#[deriving(Eq,Clone,Encodable)]
pub struct EventListener{

  parent: CallbackInterface,
}

@larsbergstrom

Copy link
Copy Markdown
Author
#[deriving(Clone,Eq)]
pub struct CallbackInterface {
    callback: *JSObject
}

impl<S: Encoder<()>> Encodable<S, ()> for CallbackInterface {
    fn encode(&self, s: &mut S) -> Result<(), ()> {
        unsafe {
            let tracer: *mut JSTracer = cast::transmute(s);
            "callback".to_c_str().with_ref(|name| {
                (*tracer).debugPrinter = ptr::null();
                (*tracer).debugPrintIndex = -1;
                (*tracer).debugPrintArg = name as *libc::c_void;
                JS_CallTracer(tracer as *JSTracer, self.callback, JSTRACE_OBJECT as u32);
            });
        };
        Ok(())
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment