pub struct UnregisteredDevice<T: Driver>(/* private fields */);Expand description
A Device which is known at compile-time to be unregistered with userspace.
This type allows performing operations which are only safe to do before userspace registration,
and can be used to create a Registration once the driver is ready
to register the device with userspace.
Since DRM device initialization must be single-threaded, this object is not thread-safe.
§Invariants
The device in self.0 is guaranteed to be a newly created Device that has not yet been
registered with userspace until this type is dropped.
Implementations§
Source§impl<T: Driver> UnregisteredDevice<T>
impl<T: Driver> UnregisteredDevice<T>
Sourcepub fn new(
dev: &T::ParentDevice<Bound>,
data: impl PinInit<T::Data, Error>,
) -> Result<Self>
pub fn new( dev: &T::ParentDevice<Bound>, data: impl PinInit<T::Data, Error>, ) -> Result<Self>
Create a new UnregisteredDevice for a drm::Driver.
This can be used to create a Registration.
Methods from Deref<Target = Device<T, Normal>>§
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.
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§
Auto Trait Implementations§
impl<T> Freeze for UnregisteredDevice<T>
impl<T> !RefUnwindSafe for UnregisteredDevice<T>
impl<T> !Send for UnregisteredDevice<T>
impl<T> !Sync for UnregisteredDevice<T>
impl<T> Unpin for UnregisteredDevice<T>
impl<T> !UnwindSafe for UnregisteredDevice<T>
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
Source§impl<S, T> IntoSafeCast<T> for Swhere
T: FromSafeCast<S>,
impl<S, T> IntoSafeCast<T> for Swhere
T: FromSafeCast<S>,
Source§fn into_safe_cast(self) -> T
fn into_safe_cast(self) -> T
self into a T. This operation is guaranteed to be lossless.Source§impl<S, T> IntoSafeCastArch<T> for Swhere
T: FromSafeCastArch<S>,
impl<S, T> IntoSafeCastArch<T> for Swhere
T: FromSafeCastArch<S>,
Source§fn into_safe_cast_arch(self) -> T
fn into_safe_cast_arch(self) -> T
self into a T. This operation is guaranteed to be lossless.