Enum wgpu_types::DeviceLostReason
source · #[repr(u8)]pub enum DeviceLostReason {
Unknown = 0,
Destroyed = 1,
Dropped = 2,
ReplacedCallback = 3,
DeviceInvalid = 4,
}
Expand description
Reason for “lose the device”.
Corresponds to WebGPU GPUDeviceLostReason
.
Variants§
Unknown = 0
Triggered by driver
Destroyed = 1
After Device::destroy
Dropped = 2
After Device::drop
WebGPU does not invoke the device lost callback when the device is dropped to prevent garbage collection from being observable. In wgpu, we invoke the callback on drop to help with managing memory owned by the callback.
ReplacedCallback = 3
After replacing the device_lost_callback
WebGPU does not have a concept of a device lost callback, but wgpu does. wgpu guarantees that any supplied callback will be invoked exactly once before it is dropped, which helps with managing the memory owned by the callback.
DeviceInvalid = 4
When setting the callback, but the device is already invalid
As above, when the callback is provided, wgpu guarantees that it will eventually be called. If the device is already invalid, wgpu will call the callback immediately, with this reason.
Trait Implementations§
source§impl Clone for DeviceLostReason
impl Clone for DeviceLostReason
source§fn clone(&self) -> DeviceLostReason
fn clone(&self) -> DeviceLostReason
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for DeviceLostReason
impl Debug for DeviceLostReason
source§impl<'de> Deserialize<'de> for DeviceLostReason
impl<'de> Deserialize<'de> for DeviceLostReason
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl PartialEq for DeviceLostReason
impl PartialEq for DeviceLostReason
source§fn eq(&self, other: &DeviceLostReason) -> bool
fn eq(&self, other: &DeviceLostReason) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for DeviceLostReason
impl Serialize for DeviceLostReason
impl Copy for DeviceLostReason
impl Eq for DeviceLostReason
impl StructuralPartialEq for DeviceLostReason
Auto Trait Implementations§
impl Freeze for DeviceLostReason
impl RefUnwindSafe for DeviceLostReason
impl Send for DeviceLostReason
impl Sync for DeviceLostReason
impl Unpin for DeviceLostReason
impl UnwindSafe for DeviceLostReason
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)