1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#![cfg(feature="include_simple")]
use std::{fmt, error};
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum CheckError {
HashMismatch,
InvalidFormat,
}
impl fmt::Display for CheckError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str(match *self {
CheckError::HashMismatch => "password hash mismatch",
CheckError::InvalidFormat => "invalid `hashed_value` format",
})
}
}
impl error::Error for CheckError {
fn description(&self) -> &str {
match *self {
CheckError::HashMismatch => "password hash mismatch",
CheckError::InvalidFormat => "invalid `hashed_value` format",
}
}
}