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 conversion between BigUInt, BigInt and primitives use dedicated traits ToBigInt, ToBigUInt and {To|From}Primitive, and not Try{From|Into} traits in std. While the functionality exists, this prevents using big integer types in a generic context that requires the latter. So, it would be preferable to implement them.
Some concerns:
It might be better to integrate ToBigInt and the like directly with Try{From|Into}. But I think that will cause breakage downstream, especially with {To|From}Primitive. Still, if there is a way to do this with out breaking things, this seems preferable.
Minimum supported rustc version. Since Try{From|Into} have been stable only since 1.34, I think naively implementing these would require bumping the rustc version number. Is there a way to avoid this? I'm not sure since I haven't dealt with minimum rustc versions before.
The text was updated successfully, but these errors were encountered:
I wouldn't want any breaking changes to the existing traits, but we can add TryFrom separately for new enough toolchains. TryInto comes implicitly with TryFrom. I would also be more conservative with this to match core/std, e.g. not implementing from floating point types at all. (In the existing traits we convert from floating point with truncation.)
Minimum supported rustc version. Since Try{From|Into} have been stable only since 1.34, I think naively implementing these would require bumping the rustc version number. Is there a way to avoid this?
We can add a test in build.rs like ac.emit_path_cfg("std::convert::TryFrom", "has_try_from"), and then guard the actual implementations with #[cfg(has_try_from)].
Currently conversion between
BigUInt
,BigInt
and primitives use dedicated traitsToBigInt
,ToBigUInt
and{To|From}Primitive
, and notTry{From|Into}
traits instd
. While the functionality exists, this prevents using big integer types in a generic context that requires the latter. So, it would be preferable to implement them.Some concerns:
It might be better to integrate
ToBigInt
and the like directly withTry{From|Into}
. But I think that will cause breakage downstream, especially with{To|From}Primitive
. Still, if there is a way to do this with out breaking things, this seems preferable.Minimum supported rustc version. Since
Try{From|Into}
have been stable only since 1.34, I think naively implementing these would require bumping the rustc version number. Is there a way to avoid this? I'm not sure since I haven't dealt with minimum rustc versions before.The text was updated successfully, but these errors were encountered: