diff --git a/Cargo.toml b/Cargo.toml index f0e8e2d..60d22a1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "charsets" -version = "0.1.1" +version = "0.2.0" authors = ["Pyfisch "] description = "An enum representing all charset names commonly used." readme = "README.md" diff --git a/src/lib.rs b/src/lib.rs index b5baf4f..96394a4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,34 +12,9 @@ use std::fmt::{self, Display}; use std::str::FromStr; use std::ascii::AsciiExt; -use std::error::Error as ErrorTrait; pub use self::Charset::*; -/// An error type used for this crate. -/// -/// It may be extended in the future to give more information. -#[derive(Debug, Eq, PartialEq)] -pub enum Error { - /// Parsing as as charset failed. - Invalid, -} - -impl ErrorTrait for Error { - fn description(&self) -> &str { - return "The given charset is invalid"; - } -} - -impl Display for Error { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_str(self.description()) - } -} - -/// Result type used for this library. -pub type Result = ::std::result::Result; - /// A Mime charset. /// /// The string representation is normalised to upper case. @@ -146,8 +121,8 @@ impl Display for Charset { } impl FromStr for Charset { - type Err = ::Error; - fn from_str(s: &str) -> ::Result { + type Err = (); + fn from_str(s: &str) -> Result { Ok(MAPPING.iter() .find(|&&(_, ref name)| name.eq_ignore_ascii_case(s)) .map(|&(ref variant, _)| variant.to_owned())