Struct wgpu::core::device::any_device::AnyDevice
pub struct AnyDevice { /* private fields */ }
Available on
wgpu_core
only.Expand description
A pointer to a Device<A>
, for any backend A
.
Any AnyDevice
is just like an Arc<Device<A>>
, except that the A
type
parameter is erased. To access the Device
, you must downcast to a
particular backend with the [downcast_ref
] or [downcast_clone
]
methods.
Implementations§
§impl AnyDevice
impl AnyDevice
pub fn new<A>(device: Arc<Device<A>>) -> AnyDevicewhere
A: HalApi,
pub fn new<A>(device: Arc<Device<A>>) -> AnyDevicewhere
A: HalApi,
Return an AnyDevice
that holds an owning Arc
pointer to device
.
pub fn downcast_ref<A>(&self) -> Option<&Device<A>>where
A: HalApi,
pub fn downcast_ref<A>(&self) -> Option<&Device<A>>where
A: HalApi,
If self
is an Arc<Device<A>>
, return a reference to the
device.
pub fn downcast_clone<A>(&self) -> Option<Arc<Device<A>>>where
A: HalApi,
pub fn downcast_clone<A>(&self) -> Option<Arc<Device<A>>>where
A: HalApi,
If self
is an Arc<Device<A>>
, return a clone of that.
Trait Implementations§
impl Send for AnyDevice
Available on
send_sync
only.impl Sync for AnyDevice
Available on
send_sync
only.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