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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
//! Error types for DDC/CI monitor control operations.
//!
//! This module defines [`DdcError`], the canonical error type for all
//! DDC/CI (VESA MCCS) Virtual Control Panel operations. Each variant maps
//! to a specific failure mode ranging from backend unavailability to
//! hardware communication failures.
//!
//! # Examples
//!
//! ```rust
//! use df_ddc::error::DdcError;
//!
//! let err = DdcError::AccessDenied;
//! assert!(err.to_string().contains("permissions"));
//! ```
//!
//! Every public-facing DDC operation returns `Result<T, DdcError>` to
//! allow callers to handle failures via exhaustive pattern matching.
use Error;
/// Error type for all DDC/CI (VESA MCCS) monitor control operations.
///
/// This enum replaces raw string-based errors with typed variants,
/// enabling precise error handling without string inspection.
///
/// # Variants
///
/// * [`BackendNotAvailable`](DdcError::BackendNotAvailable) — The DDC/CI
/// backend is not present on the current platform or device.
/// * [`CommunicationFailed`](DdcError::CommunicationFailed) — A hardware
/// I²C or Win32 API call failed.
/// * [`AccessDenied`](DdcError::AccessDenied) — The process lacks the
/// necessary permissions (e.g., `i2c` group membership on Linux).
/// * [`UnsupportedFeature`](DdcError::UnsupportedFeature) — The monitor
/// does not support the requested VCP code.
/// * [`InvalidDevice`](DdcError::InvalidDevice) — The device path or
/// handle does not correspond to a valid DDC/CI-capable monitor.