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
42
43
44
45
46
use crate::__gl;
use crate::device::Device;
use std::{error, fmt, result};
#[derive(Debug, PartialEq, Eq)]
pub enum Error {
OutOfMemory,
}
pub type Result<T> = result::Result<T, Error>;
impl Device {
pub(crate) unsafe fn get_error(&self) -> Result<()> {
let err = self.0.GetError();
match err {
__gl::OUT_OF_MEMORY => Err(Error::OutOfMemory),
_ => Ok(()),
}
}
}
impl error::Error for Error {}
impl fmt::Display for Error {
fn fmt(&self, fmt: &mut fmt::Formatter) -> result::Result<(), fmt::Error> {
match *self {
Error::OutOfMemory => write!(fmt, "OutOfMemory"),
}
}
}