diff options
author | Alex Crichton <alex@alexcrichton.com> | 2015-01-18 16:14:08 -0800 |
---|---|---|
committer | Alex Crichton <alex@alexcrichton.com> | 2015-01-18 16:14:08 -0800 |
commit | e2f2c5046f6079d80ed21ae21afc55249dff478a (patch) | |
tree | 79b61a47b057d3c8c555417d46402f752e1c26c0 /src/error.rs | |
parent | fd5b63c00e83d498a4badcc8cf2a7559ba0f4aa6 (diff) | |
download | ssh2-rs-e2f2c5046f6079d80ed21ae21afc55249dff478a.zip |
Tweak impls/apis
Lots of changes, but largely cosmetic, reorganization, or internal refactorings.
Diffstat (limited to 'src/error.rs')
-rw-r--r-- | src/error.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/error.rs b/src/error.rs index 7118fa9..641116e 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,8 +1,10 @@ +use std::error::Error as StdError; use std::fmt; use std::str; use libc; use {raw, Session}; +use util::Binding; /// Representation of an error that can occur within libssh2 #[derive(Show)] @@ -23,7 +25,7 @@ impl Error { let rc = raw::libssh2_session_last_error(sess.raw(), &mut msg, 0 as *mut _, 0); if rc == 0 { return None } - let s = ::opt_bytes(&STATIC, msg as *const _).unwrap();; + let s = ::opt_bytes(&STATIC, msg as *const _).unwrap(); Some(Error::new(rc, str::from_utf8(s).unwrap())) } } @@ -106,3 +108,7 @@ impl fmt::String for Error { write!(f, "[{}] {}", self.code, self.msg) } } + +impl StdError for Error { + fn description(&self) -> &str { self.message() } +} |