mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-25 06:41:31 +11:00
Implement Display, Error for ContextError
This commit is contained in:
parent
be0440666b
commit
9bcfad9f75
23
src/lib.rs
23
src/lib.rs
|
@ -150,6 +150,28 @@ pub enum ContextError {
|
||||||
ContextLost,
|
ContextLost,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl ContextError {
|
||||||
|
fn to_string(&self) -> &str {
|
||||||
|
use std::error::Error;
|
||||||
|
match *self {
|
||||||
|
ContextError::IoError(ref err) => err.description(),
|
||||||
|
ContextError::ContextLost => "Context lost."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl std::fmt::Display for ContextError {
|
||||||
|
fn fmt(&self, formatter: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
|
||||||
|
formatter.write_str(self.to_string())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl std::error::Error for ContextError {
|
||||||
|
fn description(&self) -> &str {
|
||||||
|
self.to_string()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// All APIs related to OpenGL that you can possibly get while using glutin.
|
/// All APIs related to OpenGL that you can possibly get while using glutin.
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
pub enum Api {
|
pub enum Api {
|
||||||
|
@ -539,4 +561,3 @@ mod native_monitor {
|
||||||
Unavailable
|
Unavailable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue