A common convention in Rust when converting from one type to another in a fallible way (i.e., when returning a Result,) is to name the function try_from_* instead of from_*, which is used for infallible conversions (we also see this same convention in the From and TryFrom traits.) This lets the programmer know at a glance that they're dealing with a value or a Result.
A common convention in Rust when converting from one type to another in a fallible way (i.e., when returning a Result,) is to name the function
try_from_*
instead offrom_*
, which is used for infallible conversions (we also see this same convention in theFrom
andTryFrom
traits.) This lets the programmer know at a glance that they're dealing with a value or a Result.