message: add custom Display instance for cbor_event's error
diff: +use std::fmt;
  +
  use types::Type;
  /// all expected error for cbor parsing and serialising
  @@ -32,3 +34,27 @@ impl From<::std::string::FromUtf8Error> for Error {
  impl From<::std::io::Error> for Error {
  fn from(e: ::std::io::Error) -> Self { Error::IoError(e) }
  }
  +
  +impl fmt::Display for Error {
  + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
  + use Error::*;
  + match self {
  + ExpectedU8 => write!(f, "Invalid cbor: expected 8bit long unsigned integer"),
  + ExpectedU16 => write!(f, "Invalid cbor: expected 16bit long unsigned integer"),
  + ExpectedU32 => write!(f, "Invalid cbor: expected 32bit long unsigned integer"),
  + ExpectedU64 => write!(f, "Invalid cbor: expected 64bit long unsigned integer"),
  + ExpectedI8 => write!(f, "Invalid cbor: expected 8bit long negative integer"),
  + ExpectedI16 => write!(f, "Invalid cbor: expected 16bit long negative integer"),
  + ExpectedI32 => write!(f, "Invalid cbor: expected 32bit long negative integer"),
  + ExpectedI64 => write!(f, "Invalid cbor: expected 64bit long negative integer"),
  + NotEnough(got, exp) => write!(f, "Invalid cbor: not enough bytes, expect {} bytes but received {} bytes.", exp, got),
  + Expected(exp, got) => write!(f, "Invalid cbor: not the right type, expected `{:?}' byte received `{:?}'.", exp, got),
  + UnknownLenType(byte) => write!(f, "Invalid cbor: not the right sub type: 0b{:05b}", byte),
  + IndefiniteLenNotSupported(t) => write!(f, "Invalid cbor: indefinite length not supported for cbor object of type `{:?}'.", t),
  + InvalidTextError(utf8_error) => write!(f, "Invalid cbor: expected a valid utf8 string text. {:?}", utf8_error),
  + CannotParse(t, bytes) => write!(f, "Invalid cbor: cannot parse the cbor object `{:?}' with the following bytes {:?}", t, bytes),
  + IoError(io_error) => write!(f, "Invalid cbor: I/O error: {:?}.", io_error),
  + CustomError(err) => write!(f, "Invalid cbor: {}", err)
  + }
  + }
  +}
  