Add Error trait for DeviceError
This commit is contained in:
parent
39140519da
commit
9c6e236d6a
1 changed files with 21 additions and 0 deletions
|
@ -4,6 +4,8 @@ use std::ptr;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use vk;
|
use vk;
|
||||||
use device::Device;
|
use device::Device;
|
||||||
|
use std::error::Error;
|
||||||
|
use std::fmt;
|
||||||
use RawPtr;
|
use RawPtr;
|
||||||
use version::{FunctionPointers, V1_0};
|
use version::{FunctionPointers, V1_0};
|
||||||
use version::DeviceLoader;
|
use version::DeviceLoader;
|
||||||
|
@ -14,6 +16,25 @@ pub enum DeviceError {
|
||||||
VkError(vk::Result),
|
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)]
|
#[derive(Clone)]
|
||||||
pub struct Instance<V: FunctionPointers> {
|
pub struct Instance<V: FunctionPointers> {
|
||||||
handle: vk::Instance,
|
handle: vk::Instance,
|
||||||
|
|
Loading…
Add table
Reference in a new issue