pub struct Registration<'a, F: ForLt + 'static> { /* private fields */ }Expand description
The registration of an auxiliary device.
This type represents the registration of a [struct auxiliary_device]. When its parent device
is unbound, the corresponding auxiliary device will be unregistered from the system.
The type parameter F is a ForLt encoding of the registration
data type. For non-lifetime-parameterized types, use ForLt!(T).
The data can be accessed by the auxiliary driver through Device::registration_data().
§Invariants
self.adev always holds a valid pointer to an initialized and registered
[struct auxiliary_device] whose registration_data_rust field points to a
valid Pin<KBox<RegistrationData<F::Of<'static>>>>.
Implementations§
Source§impl<'a, F: ForLt> Registration<'a, F>
impl<'a, F: ForLt> Registration<'a, F>
Sourcepub unsafe fn new_with_lt<E>(
parent: &'a Device<Bound>,
name: &CStr,
id: u32,
modname: &CStr,
data: impl PinInit<F::Of<'a>, E>,
) -> Result<Self>
pub unsafe fn new_with_lt<E>( parent: &'a Device<Bound>, name: &CStr, id: u32, modname: &CStr, data: impl PinInit<F::Of<'a>, E>, ) -> Result<Self>
Create and register a new auxiliary device with the given registration data.
The data is owned by the registration and can be accessed through the auxiliary device
via Device::registration_data().
§Safety
The caller must not mem::forget() the returned Registration or otherwise prevent its
Drop implementation from running, since the registration data may contain borrowed
references that become invalid after 'a ends.
If the registration data is 'static, use the safe Registration::new() instead.
Sourcepub fn new<E>(
parent: &'a Device<Bound>,
name: &CStr,
id: u32,
modname: &CStr,
data: impl PinInit<F::Of<'a>, E>,
) -> Result<Self>
pub fn new<E>( parent: &'a Device<Bound>, name: &CStr, id: u32, modname: &CStr, data: impl PinInit<F::Of<'a>, E>, ) -> Result<Self>
Create and register a new auxiliary device with 'static registration data.
Safe variant of Registration::new_with_lt() for registration data that does not contain
borrowed references.
Trait Implementations§
Source§impl<F: ForLt> Drop for Registration<'_, F>
impl<F: ForLt> Drop for Registration<'_, F>
impl<F: ForLt> Send for Registration<'_, F>
impl<F: ForLt> Sync for Registration<'_, F>
Auto Trait Implementations§
impl<'a, F> Freeze for Registration<'a, F>
impl<'a, F> RefUnwindSafe for Registration<'a, F>
impl<'a, F> Unpin for Registration<'a, F>
impl<'a, F> UnsafeUnpin for Registration<'a, F>
impl<'a, F> UnwindSafe for Registration<'a, F>
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> 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