This compiles fine (Decoder is serialize::Decoder trait):
fn read_field<D: Decoder, T>(d: &mut D, field: &str) -> Result<T, D::Error>
where T: Decodable
while this doesn't:
fn read_field<D, T>(d: &mut D, field: &str) -> Result<T, D::Error>
where D: Decoder, T: Decodable
yielding the following error:
src/main.rs:149:58: 149:66 error: associated type `Error` not found for type parameter `D` [E0220]
src/main.rs:149 fn read_field<D, T>(d: &mut D, field: &str) -> Result<T, D::Error>
This compiles fine (
Decoderisserialize::Decodertrait):while this doesn't:
yielding the following error: