Implemented `std::error::Error` trait for error type.

master
Alexander Regueiro 8 years ago
parent 121ed9a993
commit ffc541c650
  1. 11
      src/rocksdb.rs

@ -14,6 +14,7 @@
//
use std::collections::BTreeMap;
use std::error;
use std::ffi::CString;
use std::fmt;
use std::fs;
@ -117,6 +118,16 @@ impl From<Error> for String {
}
}
impl error::Error for Error {
fn description(&self) -> &str {
&self.message
}
fn cause(&self) -> Option<&error::Error> {
None
}
}
impl fmt::Display for Error {
fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> {
self.message.fmt(formatter)

Loading…
Cancel
Save