diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index c9b8ed8c7e..d76a1f5ea4 100644 --- a/wgpu/src/lib.rs +++ b/wgpu/src/lib.rs @@ -380,18 +380,9 @@ impl Drop for Sampler { pub type SurfaceConfiguration = wgt::SurfaceConfiguration>; static_assertions::assert_impl_all!(SurfaceConfiguration: Send, Sync); -/// This is used in [`Instance::create_surface`]. For a passed `window` to -/// fullfill the requirements, [`HasWindowHandle`], [`HasDisplayHandle`] (and -/// if not targetting Wasm [`Send`] and [`Sync`]) is required. -pub trait WgpuSurfaceRequirement: - HasWindowHandle + HasDisplayHandle + WasmNotSend + WasmNotSync -{ -} +trait WgpuSurfaceRequirement: WasmNotSend + WasmNotSync {} -impl WgpuSurfaceRequirement - for T -{ -} +impl WgpuSurfaceRequirement for T {} /// Handle to a presentable surface. /// @@ -1970,7 +1961,10 @@ impl Instance { /// - On macOS/Metal: will panic if not called on the main thread. /// - On web: will panic if the `raw_window_handle` does not properly refer to a /// canvas element. - pub fn create_surface<'window, W: WgpuSurfaceRequirement + 'window>( + pub fn create_surface< + 'window, + W: HasWindowHandle + HasDisplayHandle + WasmNotSend + WasmNotSync + 'window, + >( &self, window: W, ) -> Result, CreateSurfaceError> {