From 34c0e63c8878881e5bc0ab7ef8a07dc96baf401c Mon Sep 17 00:00:00 2001 From: Jerzy Wilczek Date: Wed, 6 Nov 2024 14:54:11 +0100 Subject: [PATCH] Make `Surface::as_hal` take an immutable reference. --- CHANGELOG.md | 4 ++++ wgpu/src/api/surface.rs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index de11b30459..abfbe5ee78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,10 @@ Bottom level categories: ### Changes +#### General + +- Make `Surface::as_hal` take an immutable reference to the surface. By @jerzywilczek in [#9999](https://github.com/gfx-rs/wgpu/pull/9999) + #### HAL - Change the `DropCallback` API to use `FnOnce` instead of `FnMut`. By @jerzywilczek in [#6482](https://github.com/gfx-rs/wgpu/pull/6482) diff --git a/wgpu/src/api/surface.rs b/wgpu/src/api/surface.rs index 6e433596da..14b482850d 100644 --- a/wgpu/src/api/surface.rs +++ b/wgpu/src/api/surface.rs @@ -159,7 +159,7 @@ impl Surface<'_> { /// - The raw handle obtained from the hal Surface must not be manually destroyed #[cfg(wgpu_core)] pub unsafe fn as_hal) -> R, R>( - &mut self, + &self, hal_surface_callback: F, ) -> Option { self.context