aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
authortomaka <pierre.krieger1708@gmail.com>2015-01-24 07:57:01 +0100
committertomaka <pierre.krieger1708@gmail.com>2015-01-24 07:57:01 +0100
commitaa9262506400aee9f16efabd015e79cc116079d7 (patch)
tree62acc844e7392ddb42242ab8fec94858981cb13c /src/lib.rs
parentbd3d7513f8a8b8c58f0f0952027f7dd1f6883f59 (diff)
parent02a57e04225b8e64bc0e853fe5540d48b7ae0b6c (diff)
downloadglutin-aa9262506400aee9f16efabd015e79cc116079d7.tar.gz
glutin-aa9262506400aee9f16efabd015e79cc116079d7.zip
Merge pull request #224 from andrewrk/fix-error-trait
fix for latest rustc
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/lib.rs b/src/lib.rs
index cfefe99..f31edfe 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -67,14 +67,14 @@ mod events;
pub struct MonitorID(winimpl::MonitorID);
/// Error that can happen while creating a window or a headless renderer.
-#[derive(Clone, Show, PartialEq, Eq)]
+#[derive(Clone, Debug, PartialEq, Eq)]
pub enum CreationError {
OsError(String),
NotSupported,
}
-impl std::error::Error for CreationError {
- fn description(&self) -> &str {
+impl CreationError {
+ fn to_string(&self) -> &str {
match self {
&CreationError::OsError(ref text) => text.as_slice(),
&CreationError::NotSupported => "Some of the requested attributes are not supported",
@@ -82,8 +82,20 @@ impl std::error::Error for CreationError {
}
}
+impl std::fmt::Display for CreationError {
+ fn fmt(&self, formatter: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
+ formatter.write_str(self.to_string())
+ }
+}
+
+impl std::error::Error for CreationError {
+ fn description(&self) -> &str {
+ self.to_string()
+ }
+}
+
/// All APIs related to OpenGL that you can possibly get while using glutin.
-#[derive(Show, Clone, Copy, PartialEq, Eq)]
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Api {
/// The classical OpenGL. Available on Windows, Linux, OS/X.
OpenGl,
@@ -91,7 +103,7 @@ pub enum Api {
OpenGlEs,
}
-#[derive(Show, Copy)]
+#[derive(Debug, Copy)]
pub enum MouseCursor {
/// The platform-dependent default cursor.
Default,