Add Error trait for DeviceError
This commit is contained in:
parent
39140519da
commit
9c6e236d6a
|
@ -4,6 +4,8 @@ use std::ptr;
|
|||
use std::mem;
|
||||
use vk;
|
||||
use device::Device;
|
||||
use std::error::Error;
|
||||
use std::fmt;
|
||||
use RawPtr;
|
||||
use version::{FunctionPointers, V1_0};
|
||||
use version::DeviceLoader;
|
||||
|
@ -14,6 +16,25 @@ pub enum DeviceError {
|
|||
VkError(vk::Result),
|
||||
}
|
||||
|
||||
impl fmt::Display for DeviceError{
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result{
|
||||
write!(f, "DeviceError::{:?}", self)
|
||||
}
|
||||
}
|
||||
|
||||
impl Error for DeviceError {
|
||||
fn description(&self) -> &str {
|
||||
"DeviceErrorr"
|
||||
}
|
||||
|
||||
fn cause(&self) -> Option<&Error>{
|
||||
if let &DeviceError::VkError(ref err) = self{
|
||||
return err.cause();
|
||||
}
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Instance<V: FunctionPointers> {
|
||||
handle: vk::Instance,
|
||||
|
|
Loading…
Reference in a new issue