Skip to content
This repository has been archived by the owner on Aug 18, 2020. It is now read-only.

Build failing on serialise::Decoder trait #19

Closed
michaeljones opened this issue Aug 3, 2014 · 2 comments
Closed

Build failing on serialise::Decoder trait #19

michaeljones opened this issue Aug 3, 2014 · 2 comments

Comments

@michaeljones
Copy link

I'm getting the following error message when building:

src/lib.rs:255:1: 477:2 error: not all trait methods implemented, missing: `error` [E0046]
src/lib.rs:255 impl<'a> serialize::Decoder<IoError> for Decoder<'a> {
src/lib.rs:256     #[inline(always)]

I am very new to rust. First code written today. This patch fixes the build error but I've no idea what the correct implementation is. That IoError line is partially copied from further up the file:

diff --git a/src/lib.rs b/src/lib.rs
index 9b23b89..28e2146 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -474,6 +474,10 @@ impl<'a> serialize::Decoder<IoError> for Decoder<'a> {
         -> IoResult<T> {
             self.read_tuple_arg(idx, f)
         }
+
+    fn error(&mut self, _err: &str) -> IoError {
+        IoError{kind: InvalidInput, desc: "", detail: None}
+    }
 }

 impl<'a> serialize::Decodable<Decoder<'a>, IoError> for Value {

An example from the rust code base can be seen here:

https://github.com/rust-lang/rust/blob/5bd8edc1121a5736994d69b2dc9cf3efb6fbc116/src/libserialize/json.rs#L2076

From the commit history, it looks like it was added 3 days ago. Possibly merged even more recently.

Thanks for writing the msgpack support.

@mneumann
Copy link
Owner

mneumann commented Aug 4, 2014

Thanks! This method is new. I added it. One day we also want nicer error messages, similar to DecodeError https://github.com/rust-lang/rust/blob/5bd8edc1121a5736994d69b2dc9cf3efb6fbc116/src/libserialize/json.rs#L255.

@michaeljones
Copy link
Author

Great, thanks :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants