When in doubt, prefer to_`to_/`/as_`as_/`/into_`into_to` to from_`from_`, because they are
more ergonomic to use (and can be chained with other methods).
For many conversions between two types, one of the types is clearly more
"specific": it provides some additional invariant or interpretation that is not
present in the other type. For example, str`stris more specific than&[u8]`,
since it is a utf-8 encoded sequence of bytes.
Conversions should live with the more specific of the involved types. Thus,
str`strprovides both theas_bytesmethod and thefrom_utf8constructor for converting to and from&[u8]values. Besides being intuitive, this convention avoids polluting concrete types like&[u8]` with endless conversion methods.
If a function's name implies that it is a conversion (prefix from_`from_,`, as_`as_,`,
to_`to_or` or into_`into_), but the function loses information, add a suffix_lossy` or
otherwise indicate the lossyness. Consider avoiding the conversion name prefix.