Introduce Error::ContextCreationFailed

This commit is contained in:
Richard 2022-01-27 04:00:53 -03:00
parent a33e320521
commit 1e62fdf069
5 changed files with 39 additions and 18 deletions

View file

@ -11,9 +11,9 @@ pub enum Error {
#[error("the application window could not be created")]
WindowCreationFailed(Box<dyn std::error::Error + Send + Sync>),
/// A suitable graphics adapter or device could not be found.
#[error("a suitable graphics adapter or device could not be found")]
GraphicsAdapterNotFound,
/// The application context could not be created.
#[error("the application context could not be created")]
ContextCreationFailed(iced_graphics::Error),
}
impl From<iced_winit::Error> for Error {
@ -25,8 +25,8 @@ impl From<iced_winit::Error> for Error {
iced_winit::Error::WindowCreationFailed(error) => {
Error::WindowCreationFailed(Box::new(error))
}
iced_winit::Error::GraphicsAdapterNotFound => {
Error::GraphicsAdapterNotFound
iced_winit::Error::ContextCreationFailed(error) => {
Error::ContextCreationFailed(error)
}
}
}