Merge pull request #92 from alexreg/error

Implemented `std::error::Error` trait for error type.
master
Tyler Neely 8 years ago committed by GitHub
commit 7f2188c39d
  1. 7
      src/rocksdb.rs

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

Loading…
Cancel
Save