enum-code 0.1.1

derive(Code) simplifies error handling by providing an easy-to-use enumeration of error codes
Documentation
#[derive(enum_code::Code)]
enum TestError {
    #[code(1)]
    Tuple(String),
    #[code(2)]
    #[allow(dead_code)]
    Struct { message: String },
    #[code(3)]
    Simple,
}

#[test]
fn test_code() {
    assert_eq!(TestError::Tuple("test".to_string()).get_code(), 1);
    assert_eq!(
        TestError::Struct {
            message: "test".to_string()
        }
        .get_code(),
        2
    );
    assert_eq!(TestError::Simple.get_code(), 3);
}