1use mtl_foundation::Integer;
7
8#[repr(transparent)]
12#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
13pub struct IOStatus(pub Integer);
14
15impl IOStatus {
16 pub const PENDING: Self = Self(0);
17 pub const CANCELLED: Self = Self(1);
18 pub const ERROR: Self = Self(2);
19 pub const COMPLETE: Self = Self(3);
20}
21
22#[repr(transparent)]
26#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
27pub struct IOPriority(pub Integer);
28
29impl IOPriority {
30 pub const HIGH: Self = Self(0);
31 pub const NORMAL: Self = Self(1);
32 pub const LOW: Self = Self(2);
33}
34
35#[repr(transparent)]
39#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
40pub struct IOCommandQueueType(pub Integer);
41
42impl IOCommandQueueType {
43 pub const CONCURRENT: Self = Self(0);
44 pub const SERIAL: Self = Self(1);
45}
46
47#[repr(transparent)]
51#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
52pub struct IOError(pub Integer);
53
54impl IOError {
55 pub const URL_INVALID: Self = Self(1);
56 pub const INTERNAL: Self = Self(2);
57}
58
59#[repr(transparent)]
63#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
64pub struct IOCompressionStatus(pub Integer);
65
66impl IOCompressionStatus {
67 pub const COMPLETE: Self = Self(0);
68 pub const ERROR: Self = Self(1);
69}
70
71#[cfg(test)]
74mod tests {
75 use super::*;
76
77 #[test]
78 fn test_io_status_values() {
79 assert_eq!(IOStatus::PENDING.0, 0);
80 assert_eq!(IOStatus::CANCELLED.0, 1);
81 assert_eq!(IOStatus::ERROR.0, 2);
82 assert_eq!(IOStatus::COMPLETE.0, 3);
83 }
84
85 #[test]
86 fn test_io_priority_values() {
87 assert_eq!(IOPriority::HIGH.0, 0);
88 assert_eq!(IOPriority::NORMAL.0, 1);
89 assert_eq!(IOPriority::LOW.0, 2);
90 }
91
92 #[test]
93 fn test_io_command_queue_type_values() {
94 assert_eq!(IOCommandQueueType::CONCURRENT.0, 0);
95 assert_eq!(IOCommandQueueType::SERIAL.0, 1);
96 }
97
98 #[test]
99 fn test_io_error_values() {
100 assert_eq!(IOError::URL_INVALID.0, 1);
101 assert_eq!(IOError::INTERNAL.0, 2);
102 }
103
104 #[test]
105 fn test_io_compression_status_values() {
106 assert_eq!(IOCompressionStatus::COMPLETE.0, 0);
107 assert_eq!(IOCompressionStatus::ERROR.0, 1);
108 }
109}