pub struct SurfaceAttachment { /* private fields */ }Expand description
Native presentation resources that are discarded on host suspension.
The surface keeps the owned raw-window-handle provider alive. Configuration, capabilities, and the host pre-present callback therefore share exactly the same lifetime and are dropped before the native target owner can be released.
§Examples
use ailloli_ui_render_wgpu::pipeline_cache::SurfaceAttachment;
assert!(std::mem::size_of::<SurfaceAttachment>() > 0);Implementations§
Source§impl SurfaceAttachment
impl SurfaceAttachment
Sourcepub fn config(&self) -> &SurfaceConfiguration
pub fn config(&self) -> &SurfaceConfiguration
Returns the last configuration successfully applied to the surface.
Width and height are physical pixels and are nonzero for a configured attachment.
§Examples
use ailloli_ui_render_wgpu::pipeline_cache::SurfaceAttachment;
fn width(attachment: &SurfaceAttachment) -> u32 {
attachment.config().width
}Sourcepub fn capabilities(&self) -> &SurfaceCapabilities
pub fn capabilities(&self) -> &SurfaceCapabilities
Returns the capabilities snapshot captured at the last configuration.
Callers needing a fresh snapshot should use
WgpuSurfaceBundle::surface_capabilities.
§Examples
use ailloli_ui_render_wgpu::pipeline_cache::SurfaceAttachment;
fn formats(attachment: &SurfaceAttachment) -> usize {
attachment.capabilities().formats.len()
}Trait Implementations§
Auto Trait Implementations§
impl !Freeze for SurfaceAttachment
impl !RefUnwindSafe for SurfaceAttachment
impl Send for SurfaceAttachment
impl Sync for SurfaceAttachment
impl Unpin for SurfaceAttachment
impl !UnwindSafe for SurfaceAttachment
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more