pub struct Device { /* private fields */ }
Expand description
A device.
Devices can be cloned, which is equivalent to Arc::clone()
.
Devices (other than the host) are unique:
let a = Device::builder().build()?;
let b = Device::builder().build()?;
assert_ne!(a, b);
Implementations§
source§impl Device
impl Device
sourcepub fn builder() -> DeviceBuilder
pub fn builder() -> DeviceBuilder
A builder for creating a device.
sourcepub fn info(&self) -> Option<&Arc<DeviceInfo>>
pub fn info(&self) -> Option<&Arc<DeviceInfo>>
Device info.
The host returns None.
sourcepub fn wait(&self) -> Result<(), DeviceLost>
pub fn wait(&self) -> Result<(), DeviceLost>
Wait for previous work to finish.
If host, this does nothing.
Operations (like kernel dispatches) executed after this method is called will not block, and will not be waited on.
This is primarily for benchmarking, manual synchronization is unnecessary.
Trait Implementations§
source§impl Debug for Device
impl Debug for Device
Prints Device(index, handle)
where handle is a u64 that uniquely
identifies the device.
See .info()
for printing device info.
source§impl Default for Device
impl Default for Device
See Device::host()
.
source§impl PartialEq for Device
impl PartialEq for Device
impl Eq for Device
impl StructuralPartialEq for Device
Auto Trait Implementations§
impl Freeze for Device
impl !RefUnwindSafe for Device
impl Send for Device
impl Sync for Device
impl Unpin for Device
impl !UnwindSafe for Device
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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