Skip to content

Commit

Permalink
Address review
Browse files Browse the repository at this point in the history
  • Loading branch information
daxpedda committed Nov 16, 2023
1 parent 8b89667 commit 8807683
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions wgpu/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,18 +380,9 @@ impl Drop for Sampler {
pub type SurfaceConfiguration = wgt::SurfaceConfiguration<Vec<TextureFormat>>;
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<T: HasWindowHandle + HasDisplayHandle + WasmNotSend + WasmNotSync> WgpuSurfaceRequirement
for T
{
}
impl<T: WasmNotSend + WasmNotSync> WgpuSurfaceRequirement for T {}

/// Handle to a presentable surface.
///
Expand Down Expand Up @@ -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<Surface<'window>, CreateSurfaceError> {
Expand Down

0 comments on commit 8807683

Please sign in to comment.