1
Fork 0

convert: remove FromError, use From<E> instead

This removes the FromError trait, since it can now be expressed using
the new convert::Into trait. All implementations of FromError<E> where
changed to From<E>, and `try!` was changed to use From::from instead.

Because this removes FromError, it is a breaking change, but fixing it
simply requires changing the words `FromError` to `From`, and
`from_error` to `from`.

[breaking-change]
This commit is contained in:
Sean McArthur 2015-03-30 17:56:48 -07:00
parent 9de34a84bb
commit e17f4fc1d4
10 changed files with 30 additions and 50 deletions

View file

@ -365,8 +365,8 @@ impl std::error::Error for EncoderError {
fn description(&self) -> &str { "encoder error" }
}
impl std::error::FromError<fmt::Error> for EncoderError {
fn from_error(err: fmt::Error) -> EncoderError { EncoderError::FmtError(err) }
impl From<fmt::Error> for EncoderError {
fn from(err: fmt::Error) -> EncoderError { EncoderError::FmtError(err) }
}
pub type EncodeResult = Result<(), EncoderError>;