1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
use crate::{renderer::error::RendererError, sound::error::SoundError};
use glutin::{ContextError, CreationError};
#[derive(Debug)]
pub enum EngineError {
Sound(SoundError),
Renderer(RendererError),
ContextCreationError(CreationError),
ContextError(ContextError),
}
impl From<SoundError> for EngineError {
fn from(sound: SoundError) -> Self {
Self::Sound(sound)
}
}
impl From<RendererError> for EngineError {
fn from(renderer: RendererError) -> Self {
Self::Renderer(renderer)
}
}
impl From<CreationError> for EngineError {
fn from(e: CreationError) -> Self {
Self::ContextCreationError(e)
}
}
impl From<ContextError> for EngineError {
fn from(e: ContextError) -> Self {
Self::ContextError(e)
}
}