Crate fromage

Source
Expand description

Traits for conversions between non-local types.

The traits in this crate provide a way to convert from one type to another type. Each trait serves a different purpose:

  • Implement the From trait for consuming value-to-value conversions
  • Implement the Into trait for consuming value-to-value conversions to types outside the current crate
  • The TryFrom and TryInto traits behave like From and Into, but should be implemented when the conversion can fail.

Traitsยง

Fromage
Used to do value-to-value conversions while consuming the input value. It is the reciprocal of Intoage.
Intoage
A value-to-value conversion that consumes the input value. The opposite of Fromage.
TryFromage
Simple and safe type conversions that may fail in a controlled way under some circumstances. It is the reciprocal of TryIntoage.
TryIntoage
An attempted conversion that consumes self, which may or may not be expensive.