Struct DeviceHandle
pub struct DeviceHandle<S, I = ChannelDeviceHandle>where
I: DeviceHandleSpec,
S: ?Sized,{ /* private fields */ }Expand description
Implementations§
§impl<S, I> DeviceHandle<S, I>where
S: DeviceService,
I: DeviceHandleSpec,
impl<S, I> DeviceHandle<S, I>where
S: DeviceService,
I: DeviceHandleSpec,
pub fn insert( device_id: DeviceId, service: S, ) -> Result<DeviceHandle<S, I>, ServiceCreationError>
pub fn new(device_id: DeviceId) -> DeviceHandle<S, I>
§impl<S, I> DeviceHandle<S, I>where
S: 'static + ?Sized,
I: DeviceHandleSpec,
impl<S, I> DeviceHandle<S, I>where
S: 'static + ?Sized,
I: DeviceHandleSpec,
pub const fn is_blocking() -> bool
pub fn seen_as<T>(
self,
cast: fn(&mut (dyn Any + 'static)) -> &mut T,
) -> DeviceHandle<T, I>where
T: ?Sized,
pub fn seen_as<T>(
self,
cast: fn(&mut (dyn Any + 'static)) -> &mut T,
) -> DeviceHandle<T, I>where
T: ?Sized,
The same service, seen as T: cast turns the state this handle
already reaches into a T, once per task, on the thread that runs it.
pub fn device_id(&self) -> DeviceId
pub fn service_id(&self) -> ServiceId
pub fn service_id(&self) -> ServiceId
The service this handle reaches: its device and its concrete type, whatever it is seen as.
pub fn utilities(&self) -> Arc<dyn Any + Send + Sync> ⓘ
pub fn submit_blocking<'a, R, T>(&self, task: T) -> Result<R, CallError>
pub fn submit<T>(&self, task: T)
pub fn flush_queue(&self)
pub fn exclusive<R, T>(&self, task: T) -> Result<R, CallError>
pub fn shutdown(device_id: DeviceId)
pub fn shutdown(device_id: DeviceId)
Stops the background runner threads for device_id, blocking until they
exit. Queued tasks run before the threads stop. Live handles keep their
runner alive, so all handles for the device should be dropped first.
Only meaningful for handle implementations with background threads; a no-op otherwise.
§Scope
This is device-wide, and S is ignored. It shuts down every
DeviceService registered on device_id, across both service stages, not
only S. The type parameter selects the handle implementation to dispatch
through, nothing more.
DeviceId is not unique across runtimes either: type_id is assigned per
runtime, so distinct backends can hand out the same id. Shutting down a
device from one runtime can therefore tear down another runtime’s services
on the colliding id, and block while that runtime’s handles are still live.
Trait Implementations§
§impl<S, I> Clone for DeviceHandle<S, I>where
I: DeviceHandleSpec,
S: ?Sized,
impl<S, I> Clone for DeviceHandle<S, I>where
I: DeviceHandleSpec,
S: ?Sized,
§fn clone(&self) -> DeviceHandle<S, I>
fn clone(&self) -> DeviceHandle<S, I>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl<S, I> Freeze for DeviceHandle<S, I>
impl<S, I> RefUnwindSafe for DeviceHandle<S, I>where
I: RefUnwindSafe,
S: ?Sized,
impl<S, I> Send for DeviceHandle<S, I>
impl<S, I> Sync for DeviceHandle<S, I>
impl<S, I> Unpin for DeviceHandle<S, I>
impl<S, I> UnsafeUnpin for DeviceHandle<S, I>where
I: UnsafeUnpin,
S: ?Sized,
impl<S, I> UnwindSafe for DeviceHandle<S, I>where
I: UnwindSafe,
S: ?Sized,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<K, Q> Comparable<Q> for K
impl<K, Q> Comparable<Q> for K
§impl<K, Q> Equivalent<Q> for K
impl<K, Q> Equivalent<Q> for K
§fn equivalent(&self, key: &Q) -> bool
fn equivalent(&self, key: &Q) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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