You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, {From,TryFrom,Into}Proto each define their own associated type Proto, which is (silently) expected to be the same for Into and [Try]From. This is a relic of early prototyping that made it easier to rapidly iterate (as implementing Into didn't require implementing [Try]From, etc).
Define one trait Proto that defines an associated type Proto
Perhaps name the associated type Raw?
Add Proto as a supertrait of {From,TryFrom,Into}Proto
{From,TryFrom,Into}Proto will become convenience traits over {From,TryFrom,Into}<<Self as Proto>::Proto>
NOTE: Due to the never type still being unstable (:pensive:), FromProto and TryFromProto will remain as a way to differentiate fallible and infallible conversion (as opposed to putting everything in Proto). If Result::into_ok was stable, that could be used instead as a hypothetical Proto::Error type, but unfortunately it seems to be quite far away from stabilization. We could define an extension trait, but that results in rust-lang/rust#48919, which is annoying (and I'm not sure what else to call the method).
The text was updated successfully, but these errors were encountered:
…424)
`{From,TryFrom,Into}Proto` no longer each define an associated type
`Proto`, instead there is a supertrait `Proto` and the aformentioned
traits are now a bounds alias/ convenience over `T: Proto +
{From,TryFrom,Into}<T::Proto>`.
closes#420 (nice 😎)
Currently,
{From,TryFrom,Into}Proto
each define their own associated typeProto
, which is (silently) expected to be the same forInto
and[Try]From
. This is a relic of early prototyping that made it easier to rapidly iterate (as implementingInto
didn't require implementing[Try]From
, etc).Proto
that defines an associated typeProto
Raw
?Proto
as a supertrait of{From,TryFrom,Into}Proto
{From,TryFrom,Into}Proto
will become convenience traits over{From,TryFrom,Into}<<Self as Proto>::Proto>
NOTE: Due to the never type still being unstable (:pensive:),
FromProto
andTryFromProto
will remain as a way to differentiate fallible and infallible conversion (as opposed to putting everything inProto
). IfResult::into_ok
was stable, that could be used instead as a hypotheticalProto::Error
type, but unfortunately it seems to be quite far away from stabilization. We could define an extension trait, but that results in rust-lang/rust#48919, which is annoying (and I'm not sure what else to call the method).The text was updated successfully, but these errors were encountered: