wgpu-hal 31.0.0

Hardware abstraction layer for wgpu, the cross-platform, safe, pure-rust graphics API
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use windows::Win32::Foundation::{CloseHandle, HANDLE};

/// An owned Win32 NT handle that closes itself on drop.
pub struct OwnedHandle(pub HANDLE);

// The handle is just an opaque OS resource; sharing it across threads is sound.
unsafe impl Send for OwnedHandle {}
unsafe impl Sync for OwnedHandle {}

impl Drop for OwnedHandle {
    fn drop(&mut self) {
        if !self.0.is_invalid() {
            let _ = unsafe { CloseHandle(self.0) };
        }
    }
}