pub struct DeviceHandle<S, I = ChannelDeviceHandle>where
I: DeviceHandleSpec,
S: ?Sized,{ /* private fields */ }Expand description
Implementations§
Source§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>
Source§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
Sourcepub 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
Sourcepub 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>
Sourcepub 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§
Source§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,
Source§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>
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>
impl<S, I> UnwindSafe for DeviceHandle<S, I>
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> CloneExpand for Twhere
T: Clone,
impl<T> CloneExpand for Twhere
T: Clone,
fn __expand_clone_method(&self, _: &Scope) -> T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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