derive_more
derive_more copied to clipboard
Specifying the error type for TryFrom implementations
trafficstars
Would it be possible to allow users to specify the error type returned from TryFrom implementations? Something like
#[derive(From)]
struct UnknownMode(u8);
#[derive(TryFrom)]
#[try_from(repr, error = UnknownMode)]
#[repr(u8)]
enum Mode {
Foo,
Bar,
}
where the given error has to implement From<T> where T is the type for which TryFrom<T> is being implemented.