error: Implement From<std::string::ParseError>.

This commit is contained in:
Emmanuel Gil Peyrot 2017-05-06 12:48:42 +01:00
parent e3acb55b49
commit 51eecda4fd

View file

@ -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<num::ParseIntError> for Error {
}
}
impl From<string::ParseError> for Error {
fn from(err: string::ParseError) -> Error {
Error::ParseStringError(err)
}
}
impl From<jid::JidParseError> for Error {
fn from(err: jid::JidParseError) -> Error {
Error::JidParseError(err)