pub struct Device<T: Driver, C: DeviceContext = Normal> { /* private fields */ }Expand description
A typed DRM device with a specific drm::Driver implementation and DeviceContext.
A device in the Registered context is currently registered with userspace and its parent
bus device is bound. The Normal context is the general-purpose, reference-counted context.
§Invariants
self.devis a valid instance of astruct device.- The data layout of
Selfremains the same across all implementations ofC. - Any invariants for
Calso apply.
Implementations§
Source§impl<T: Driver> Device<T, Ioctl>
impl<T: Driver> Device<T, Ioctl>
Sourcepub fn registration_guard(&self) -> Option<RegistrationGuard<'_, T>>
pub fn registration_guard(&self) -> Option<RegistrationGuard<'_, T>>
Guard against the parent bus device being unbound.
Returns a RegistrationGuard if the device has not been unplugged, None otherwise.
While RegistrationGuard is held the parent device is guaranteed to be bound.
Source§impl<T: Driver> Device<T, Registered>
impl<T: Driver> Device<T, Registered>
Sourcepub fn registration_data_with<R, F>(&self, f: F) -> Rwhere
F: for<'a> FnOnce(&'a T::RegistrationData<'a>) -> R,
pub fn registration_data_with<R, F>(&self, f: F) -> Rwhere
F: for<'a> FnOnce(&'a T::RegistrationData<'a>) -> R,
Access the registration data through a closure, with the lifetime tied to the closure scope.
The data is owned by Registration and is guaranteed to remain valid
as long as the device is registered, since Registration’s drop
calls drm_dev_unplug() which waits for all drm_dev_enter() critical sections to
complete.
Trait Implementations§
Source§impl<T: Driver> AlwaysRefCounted for Device<T>
impl<T: Driver> AlwaysRefCounted for Device<T>
Source§impl<T: Driver> AsRef<<T as Driver>::ParentDevice<Bound>> for Device<T, Registered>
impl<T: Driver> AsRef<<T as Driver>::ParentDevice<Bound>> for Device<T, Registered>
Source§fn as_ref(&self) -> &T::ParentDevice<Bound>
fn as_ref(&self) -> &T::ParentDevice<Bound>
Source§impl<T: Driver> AsRef<<T as Driver>::ParentDevice<Normal>> for Device<T>
impl<T: Driver> AsRef<<T as Driver>::ParentDevice<Normal>> for Device<T>
Source§fn as_ref(&self) -> &T::ParentDevice<Normal>
fn as_ref(&self) -> &T::ParentDevice<Normal>
impl<T, C, const ID: u64> HasDelayedWork<Device<T, C>, ID> for Device<T, C>
Source§impl<T, C, const ID: u64> HasWork<Device<T, C>, ID> for Device<T, C>
impl<T, C, const ID: u64> HasWork<Device<T, C>, ID> for Device<T, C>
Source§unsafe fn raw_get_work(ptr: *mut Self) -> *mut Work<Self, ID>
unsafe fn raw_get_work(ptr: *mut Self) -> *mut Work<Self, ID>
Work<T, ID> field. Read moreSource§unsafe fn work_container_of(ptr: *mut Work<Self, ID>) -> *mut Self
unsafe fn work_container_of(ptr: *mut Work<Self, ID>) -> *mut Self
Work<T, ID> field. Read moreimpl<T: Driver, C: DeviceContext> Send for Device<T, C>
impl<T: Driver, C: DeviceContext> Sync for Device<T, C>
Auto Trait Implementations§
impl<T, C = Normal> !Freeze for Device<T, C>
impl<T, C = Normal> !RefUnwindSafe for Device<T, C>
impl<T, C = Normal> !Unpin for Device<T, C>
impl<T, C = Normal> !UnsafeUnpin for Device<T, C>
impl<T, C> UnwindSafe for Device<T, C>where
<T as Driver>::Data: UnwindSafe,
C: UnwindSafe,
<T as Driver>::RegistrationData<'static>: RefUnwindSafe,
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> KnownSize for T
impl<T> KnownSize for T
Source§impl<T> PinInit<T> for T
impl<T> PinInit<T> for T
Source§unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), Infallible>
unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), Infallible>
slot. Read more