mirror of
https://github.com/encounter/rust-sdl2.git
synced 2026-07-10 21:18:41 -07:00
Implement Error for SDL Error.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
use std::error;
|
||||
use std::ffi::{CStr, CString, NulError};
|
||||
use std::fmt;
|
||||
use std::rc::Rc;
|
||||
@@ -28,6 +29,20 @@ impl fmt::Display for Error {
|
||||
}
|
||||
}
|
||||
|
||||
impl error::Error for Error {
|
||||
fn description(&self) -> &str {
|
||||
use self::Error::*;
|
||||
|
||||
match *self {
|
||||
NoMemError => "out of memory",
|
||||
ReadError => "error reading from datastream",
|
||||
WriteError => "error writing to datastream",
|
||||
SeekError => "error seeking in datastream",
|
||||
UnsupportedError => "unknown SDL error"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
use std::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT};
|
||||
/// Only one Sdl context can be alive at a time.
|
||||
/// Set to false by default (not alive).
|
||||
|
||||
Reference in New Issue
Block a user