Struct wgpu_core::any_surface::AnySurface
source · pub struct AnySurface(/* private fields */);
Expand description
A Arc
of a HalSurface<A>
, for any backend A
.
Any AnySurface
is just like an Arc<HalSurface<A>>
, except that the
A
type parameter is erased. To access the Surface
, you must
downcast to a particular backend with the [downcast_ref
] or
[take
] methods.
Implementations§
source§impl AnySurface
impl AnySurface
sourcepub fn new<A: HalApi>(surface: HalSurface<A>) -> AnySurface
pub fn new<A: HalApi>(surface: HalSurface<A>) -> AnySurface
Return an AnySurface
that holds an owning Arc
to HalSurface
.
pub fn backend(&self) -> Backend
sourcepub fn downcast_ref<A: HalApi>(&self) -> Option<&HalSurface<A>>
pub fn downcast_ref<A: HalApi>(&self) -> Option<&HalSurface<A>>
If self
is an Arc<HalSurface<A>>
, return a reference to the
HalSurface.
Trait Implementations§
Auto Trait Implementations§
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