From 51eecda4fd10025970aafd481a6bd3a52c2231bd Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sat, 6 May 2017 12:48:42 +0100 Subject: [PATCH] error: Implement From. --- src/error.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/error.rs b/src/error.rs index a65f7e2..2f7b254 100644 --- a/src/error.rs +++ b/src/error.rs @@ -7,6 +7,7 @@ use std::convert::From; use std::io; use std::num; +use std::string; use base64; use minidom; @@ -19,6 +20,7 @@ pub enum Error { XMLError(minidom::Error), Base64Error(base64::DecodeError), ParseIntError(num::ParseIntError), + ParseStringError(string::ParseError), JidParseError(jid::JidParseError), } @@ -46,6 +48,12 @@ impl From for Error { } } +impl From for Error { + fn from(err: string::ParseError) -> Error { + Error::ParseStringError(err) + } +} + impl From for Error { fn from(err: jid::JidParseError) -> Error { Error::JidParseError(err)