i64
into an i32
using the
Into
trait, because an i64
may contain a value that an i32
cannot represent and so
the conversion would lose data. This might be handled by truncating the i64
to an i32
or by simply returning Bounded::::MAX
, or by some other method. The Into
trait
is intended for perfect conversions, so the TryInto
trait informs the programmer when a type
conversion could go bad and lets them decide how to handle it.
TryInto
is reflexive, which means that TryInto
is implementedTryInto
is implemented for all types that implement Into
None
.