Skip to main content

euv_core/platform/backend/
impl.rs

1use super::*;
2
3/// Display formatting for `PlatformError`.
4impl fmt::Display for PlatformError {
5    /// Formats `PlatformError` into a human-readable diagnostic message.
6    ///
7    /// # Arguments
8    ///
9    /// - `&Self` - Error value.
10    /// - `&mut Formatter<'_>` - Output formatter.
11    ///
12    /// # Returns
13    ///
14    /// - `fmt::Result` - Formatting status.
15    fn fmt(&self, factor_val: &mut Formatter<'_>) -> fmt::Result {
16        match self {
17            Self::WindowNotFound(id) => write!(factor_val, "{ERR_WINDOW_NOT_FOUND}: {id}"),
18            Self::InitializationFailed(msg) => {
19                write!(factor_val, "{ERR_NATIVE_INIT_FAILED}: {msg}")
20            }
21            Self::SurfaceError(msg) => write!(factor_val, "{ERR_SURFACE_UNAVAILABLE}: {msg}"),
22            Self::Unsupported(msg) => write!(factor_val, "{msg}"),
23        }
24    }
25}
26
27/// Standard `Error` marker implementation for `PlatformError`.
28impl Error for PlatformError {}