1use crate::futures;
2use crate::graphics;
3use crate::shell;
4
5#[derive(Debug, thiserror::Error)]
7pub enum Error {
8 #[error("the futures executor could not be created")]
10 ExecutorCreationFailed(futures::io::Error),
11
12 #[error("the application window could not be created")]
14 WindowCreationFailed(Box<dyn std::error::Error + Send + Sync>),
15
16 #[error("the application graphics context could not be created")]
18 GraphicsCreationFailed(graphics::Error),
19}
20
21impl From<shell::Error> for Error {
22 fn from(error: shell::Error) -> Error {
23 match error {
24 shell::Error::ExecutorCreationFailed(error) => Error::ExecutorCreationFailed(error),
25 shell::Error::WindowCreationFailed(error) => {
26 Error::WindowCreationFailed(Box::new(error))
27 }
28 shell::Error::GraphicsCreationFailed(error) => Error::GraphicsCreationFailed(error),
29 }
30 }
31}
32
33#[cfg(test)]
34mod tests {
35 use super::*;
36
37 #[test]
38 fn assert_send_sync() {
39 fn _assert<T: Send + Sync>() {}
40 _assert::<Error>();
41 }
42}