We don't like how half of TryFrom impls in std just use an None-equivalent but private error type. Like, why are the integer conversions forced to return a dummy struct instead of just returning None?
Our ideal TryFrom would look something like this:
trait TryFrom<T> {
type Result: Try<Ok=Self>;
fn try_from(t: T) -> Self::Result;
}
so that the integer conversions can just return Option<Self>
instead. Is there a crate that provides a better TryFrom? This would let us personally use Foo::try_from(bar)?
instead of Foo::try_from(bar).ok()?
which would make our code much cleaner.