Closed
Description
There is no way for a custom generic Decodable
/Encodable
instance (compatible with #[deriving]
other) to return a new error since it's completely generic, that is,
#[deriving(Decodable)]
struct Foo {
x: Bar
}
struct Bar { y: int }
// E has to be that generic to work with the deriving above,
// but this means this impl cannot manually create new errors
// (e.g. if y is supposed to be an even number, there's no way
// to emit "error: found odd number".)
impl<E, D: Decoder<E>> Decodable<D, E> for Bar { ... }
It might be nice if there was a E: Error
trait (or some such) that deriving
used, which has some basic constructors.
Metadata
Metadata
Assignees
Labels
No labels