surfman/platform/generic/egl/
error.rs1use crate::egl;
6use crate::egl::types::{EGLenum, EGLint};
7use crate::WindowingApiError;
8
9pub(crate) trait ToWindowingApiError {
10 fn to_windowing_api_error(self) -> WindowingApiError;
11}
12
13impl ToWindowingApiError for EGLint {
14 fn to_windowing_api_error(self) -> WindowingApiError {
15 match self as EGLenum {
16 egl::NOT_INITIALIZED => WindowingApiError::NotInitialized,
17 egl::BAD_ACCESS => WindowingApiError::BadAccess,
18 egl::BAD_ALLOC => WindowingApiError::BadAlloc,
19 egl::BAD_ATTRIBUTE => WindowingApiError::BadAttribute,
20 egl::BAD_CONFIG => WindowingApiError::BadConfig,
21 egl::BAD_CONTEXT => WindowingApiError::BadContext,
22 egl::BAD_CURRENT_SURFACE => WindowingApiError::BadCurrentSurface,
23 egl::BAD_DISPLAY => WindowingApiError::BadDisplay,
24 egl::BAD_SURFACE => WindowingApiError::BadSurface,
25 egl::BAD_MATCH => WindowingApiError::BadMatch,
26 egl::BAD_PARAMETER => WindowingApiError::BadParameter,
27 egl::BAD_NATIVE_PIXMAP => WindowingApiError::BadNativePixmap,
28 egl::BAD_NATIVE_WINDOW => WindowingApiError::BadNativeWindow,
29 egl::CONTEXT_LOST => WindowingApiError::ContextLost,
30 _ => WindowingApiError::Failed,
31 }
32 }
33}