Rust Conversions
The Rust documentation recommends library developers to not implement Into
and TryInto
directly but instead to implement From
and TryFrom
, which also automatically provide an implementation to (try)into. However, it also says to Prefer using Into
over using From when specifying trait bounds on a generic function.
The method .into()
and .from()
can never fail. A conversion that can potentially fail should be implemented as the try_*
equivalent.