pub struct SurfaceHandle { /* private fields */ }Expand description
A GpuSurface’s native surface, for the app to present to with its own
GPU API (wgpu, Vulkan, Metal, Direct3D), at its own pace and on its own
thread. It implements raw-window-handle’s traits, so wgpu takes it as
is: instance.create_surface(handle.clone()).
Clones share the surface, which lives until the last one is dropped.
size is kept current by the backend, so a
render thread can read it before each frame.
Implementations§
Source§impl SurfaceHandle
impl SurfaceHandle
Sourcepub fn new(native: impl NativeSurface) -> SurfaceHandle
pub fn new(native: impl NativeSurface) -> SurfaceHandle
For backends.
Sourcepub fn size(&self) -> SurfaceSize
pub fn size(&self) -> SurfaceSize
Its size now, in physical pixels.
Sourcepub fn set_size(&self, size: SurfaceSize) -> bool
pub fn set_size(&self, size: SurfaceSize) -> bool
For backends: the surface’s new size. They report it as
UiEvent::SurfaceResized too.
Returns whether it changed.
Trait Implementations§
Source§impl Clone for SurfaceHandle
impl Clone for SurfaceHandle
Source§impl Debug for SurfaceHandle
impl Debug for SurfaceHandle
Source§impl HasDisplayHandle for SurfaceHandle
impl HasDisplayHandle for SurfaceHandle
Source§fn display_handle(&self) -> Result<DisplayHandle<'_>, HandleError>
fn display_handle(&self) -> Result<DisplayHandle<'_>, HandleError>
Get a handle to the display controller of the windowing system.
Source§impl HasWindowHandle for SurfaceHandle
impl HasWindowHandle for SurfaceHandle
Source§fn window_handle(&self) -> Result<WindowHandle<'_>, HandleError>
fn window_handle(&self) -> Result<WindowHandle<'_>, HandleError>
Get a handle to the window.
Auto Trait Implementations§
impl !RefUnwindSafe for SurfaceHandle
impl !UnwindSafe for SurfaceHandle
impl Forget for SurfaceHandle
impl Freeze for SurfaceHandle
impl Send for SurfaceHandle
impl Sync for SurfaceHandle
impl Unpin for SurfaceHandle
impl UnsafeUnpin for SurfaceHandle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> HasRawDisplayHandle for Twhere
T: HasDisplayHandle + ?Sized,
impl<T> HasRawDisplayHandle for Twhere
T: HasDisplayHandle + ?Sized,
Source§fn raw_display_handle(&self) -> Result<RawDisplayHandle, HandleError>
fn raw_display_handle(&self) -> Result<RawDisplayHandle, HandleError>
👎Deprecated:
Use HasDisplayHandle instead
Source§impl<T> HasRawWindowHandle for Twhere
T: HasWindowHandle + ?Sized,
impl<T> HasRawWindowHandle for Twhere
T: HasWindowHandle + ?Sized,
Source§fn raw_window_handle(&self) -> Result<RawWindowHandle, HandleError>
fn raw_window_handle(&self) -> Result<RawWindowHandle, HandleError>
👎Deprecated:
Use HasWindowHandle instead