From 50c77a5f83fd3f3fa4ae450965ffa714c7d48082 Mon Sep 17 00:00:00 2001 From: Jay Oster Date: Sat, 4 Sep 2021 14:41:43 -0700 Subject: [PATCH] Add Send + Sync bounds for user-defined errors (#197) - This enables compatibility with anyhow and the async ecosystem --- src/lib.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 3d2e49e..0f0e8a8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -117,9 +117,11 @@ pub enum Error { Surface(wgpu::SurfaceError), /// User-defined error from custom render function #[error("User-defined error.")] - UserDefined(#[from] Box), + UserDefined(#[from] DynError), } +type DynError = Box; + impl<'win, W: HasRawWindowHandle> SurfaceTexture<'win, W> { /// Create a logical texture for a window surface. /// @@ -357,7 +359,7 @@ impl Pixels { &mut wgpu::CommandEncoder, &wgpu::TextureView, &PixelsContext, - ) -> Result<(), Box>, + ) -> Result<(), DynError>, { let frame = self .context