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, f: &mut Formatter<'_>) -> fmt::Result {
16        match self {
17            Self::WindowNotFound(id) => write!(f, "{ERR_WINDOW_NOT_FOUND}: {id}"),
18            Self::InitializationFailed(msg) => write!(f, "{ERR_NATIVE_INIT_FAILED}: {msg}"),
19            Self::SurfaceError(msg) => write!(f, "{ERR_SURFACE_UNAVAILABLE}: {msg}"),
20            Self::Unsupported(msg) => write!(f, "{msg}"),
21        }
22    }
23}
24
25/// Standard `Error` marker implementation for `PlatformError`.
26impl Error for PlatformError {}