1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//! Return values from function calls.

/// Device creation errors during `open`.
#[derive(Fail, Debug, Clone, PartialEq, Eq)]
pub enum DeviceCreationError {
    /// Memory allocation on the host side failed.
    /// This could be caused by a lack of memory.
    #[fail(display = "Host memory allocation failed.")]
    OutOfHostMemory,
    /// Memory allocation on the device side failed.
    /// This could be caused by a lack of memory.
    #[fail(display = "Device memory allocation failed.")]
    OutOfDeviceMemory,
    /// Device initialization failed due to implementation specific errors.
    #[fail(display = "Device initialization failed.")]
    InitializationFailed,
    /// At least one of the user requested extensions if not supported by the
    /// physical device.
    #[fail(display = "One or multiple extensions are not supported.")]
    MissingExtension,
    /// At least one of the user requested features if not supported by the
    /// physical device.
    ///
    /// Use [`features`](trait.PhysicalDevice.html#tymethod.features)
    /// for checking the supported features.
    #[fail(display = "One or multiple features are not supported.")]
    MissingFeature,
    /// Too many logical devices have been created from this physical device.
    ///
    /// The implementation may only support one logical device for each physical
    /// device or lacks resources to allocate a new device.
    #[fail(display = "Too many device objects have been created.")]
    TooManyObjects,
    /// The logical or physical device are lost during the device creation
    /// process.
    ///
    /// This may be caused by hardware failure, physical device removal,
    /// power outage, etc.
    #[fail(display = "Physical or logical device lost.")]
    DeviceLost,
}

/// Errors during execution of operations on the host side.
#[derive(Fail, Debug, Clone, PartialEq, Eq)]
pub enum HostExecutionError {
    /// Memory allocation on the host side failed.
    /// This could be caused by a lack of memory.
    #[fail(display = "Host memory allocation failed.")]
    OutOfHostMemory,
    /// Memory allocation on the device side failed.
    /// This could be caused by a lack of memory.
    #[fail(display = "Device memory allocation failed.")]
    OutOfDeviceMemory,
    /// The logical or physical device are lost during the device creation
    /// process.
    ///
    /// This may be caused by hardware failure, physical device removal,
    /// power outage, etc.
    #[fail(display = "Physical or logical device lost.")]
    DeviceLost,
}