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
30
31
32
33
34
//! Definition of error and status.

use std::fmt;

/// Status of `HazardEpoch`
#[derive(PartialEq, Copy, Clone, Debug)]
pub enum Status {
    /// Success
    Success,
    /// Current thread has already assigned a version handle
    Busy,
    /// Thread number overflow
    ThreadNumOverflow,
    /// Invalid parameter
    InvalidParam,
}

impl fmt::Display for Status {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{:?}", self)
    }
}

mod test {

    #[test]
    fn test_base() {
        use error::Status;

        let s = Status::Success;
        let a = format!("{}", s);
        assert_eq!(a, "Success");
    }
}