I have a branch that has been tracking rustc-serialize: drbawb/rust-msgpack/feature/rustc-serialize
After the latest changes to the serialize crate (see rust-lang/rust/pull/20514) I have been having lots of issues adopting the current architecture of the library to use associated types.
The biggest hurdle is that the signature of Decodable has changed to the following:
pub trait Decodable {
fn decode<D: Decoder>(d: &mut D) -> Result<Self, D::Error>;
}
Where D is bound by the trait serialize::Decoder.
This means that inside the decode function we do not have access to the concrete msgpack::Decoder<R> any more.
The previous definition of serialize::Decodable for Value relied on calling the msgpack::Decoder::decode_value() method, which is obviously not accessible through the Decoder trait.
I can't see any way to get access to the concrete decoder.
I even tried std::mem::transmute but because the type parameters for the underlying Reader is also removed from the serialize::Decoder trait: we lack the necessary type information to perform such a cast.
It would appear that the only option left is to re-implement msgpack::Decoder#decode_value() in terms of the generic serialize::Decoder trait.