.try_into().unwrap() sort of works, but not quite:
-
it’s a run-time check, not a compile-time check. If the conversion unexpectedly becomes lossy (e.g. a library interface changes), the compiler won’t warn you about the breakage.
-
.into()syntax is already second-class compared toas, and.try_into().unwrap()is even more verbose. Explicit integer conversions are needed sometimes even multiple times in a single expression, so verbosity matters here a lot. It’d be better ifTryIntohad a syntax sugar, e.g.as!.