1 | use ffi::*; |
2 | use libc::c_int; |
3 | |
4 | #[derive (Eq, PartialEq, Clone, Copy, Debug)] |
5 | pub enum Compliance { |
6 | VeryStrict, |
7 | Strict, |
8 | Normal, |
9 | Unofficial, |
10 | Experimental, |
11 | } |
12 | |
13 | impl From<c_int> for Compliance { |
14 | fn from(value: c_int) -> Self { |
15 | match value { |
16 | FF_COMPLIANCE_VERY_STRICT: i32 => Compliance::VeryStrict, |
17 | FF_COMPLIANCE_STRICT: i32 => Compliance::Strict, |
18 | FF_COMPLIANCE_NORMAL: i32 => Compliance::Normal, |
19 | FF_COMPLIANCE_UNOFFICIAL: i32 => Compliance::Unofficial, |
20 | FF_COMPLIANCE_EXPERIMENTAL: i32 => Compliance::Experimental, |
21 | |
22 | _ => Compliance::Normal, |
23 | } |
24 | } |
25 | } |
26 | |
27 | impl From<Compliance> for c_int { |
28 | fn from(value: Compliance) -> c_int { |
29 | match value { |
30 | Compliance::VeryStrict => FF_COMPLIANCE_VERY_STRICT, |
31 | Compliance::Strict => FF_COMPLIANCE_STRICT, |
32 | Compliance::Normal => FF_COMPLIANCE_NORMAL, |
33 | Compliance::Unofficial => FF_COMPLIANCE_UNOFFICIAL, |
34 | Compliance::Experimental => FF_COMPLIANCE_EXPERIMENTAL, |
35 | } |
36 | } |
37 | } |
38 | |