Device in kernel::auxiliary - Rust
Skip to main content Device kernel :: auxiliary Struct Device Source pub struct Device<Ctx: DeviceContext = Normal >( /* private fields */ ); Expand description The auxiliary device representation. This structure represents the Rust abstraction for a C struct auxiliary_device . The implementation abstracts the usage of an already existing C struct auxiliary_device within Rust code that we get passed from the C side. § Invariants A Device instance represents a valid struct auxiliary_device created by the C portion of the kernel.
Implementations § Source § impl<Ctx: DeviceContext > Device <Ctx> Source pub fn id (&self) -> u32 Returns the auxiliary device’ id. Source § impl Device < Bound > Source pub fn parent (&self) -> & Device < Bound > Returns a bound reference to the parent device::Device . Source pub fn registration_data_with <'this, F: ForLt + 'static, R>( &'this self, f: impl for<'a> FnOnce ( Pin <&'this F:: Of <'a>>) -> R, ) -> Result <R> Access the registration data set by the registering (parent) driver through a closure.
F is the ForLt encoding of the data type. The closure receives a pinned reference to the registration data. The outer reference carries the &self lifetime while the inner type carries the HRTB lifetime 'a , implying 'a outlives &self . This allows the closure to coerce covariant sub-fields (e.g. &'a T to the caller’s lifetime) and return them directly in R . For covariant types that implement CovariantForLt , prefer registration_data which returns a direct reference.
Returns EINVAL if F does not match the type used by the parent driver when calling Registration::new() . Returns ENOENT if no registration data has been set, e.g. when the device was registered by a C driver. Source pub fn registration_data <F: CovariantForLt + 'static>( &self, ) -> Result < Pin <&F:: Of <'_>>> Returns a pinned reference to the registration data set by the registering (parent) driver. This method is only available when F implements CovariantForLt , which guarantees that the lifetime shortening is sound.
For non-covariant types, use the closure-based Self::registration_data_with . Returns EINVAL if F does not match the type used by the parent driver when calling Registration::new() . Returns ENOENT if no registration data has been set, e.g. when the device was registered by a C driver. Source § impl Device Source pub fn parent (&self) -> & Device Returns a reference to the parent device::Device . Trait Implementations § Source § impl AlwaysRefCounted for Device Source § fn inc_ref (&self) Increments the reference count on the object.
Source § unsafe fn dec_ref (obj: NonNull <Self>) Decrements the reference count on the object. Read more Source § impl<Ctx: DeviceContext > AsBusDevice <Ctx> for Device <Ctx> Source § const OFFSET : usize The relative offset to the device field. Read more Source § unsafe fn from_device (dev: & Device <Ctx>) -> &Self where Self: Sized , Convert a reference to Device into Self . Read more Source § impl<Ctx: DeviceContext > AsRef < Device <Ctx>> for Device <Ctx> Source § fn as_ref (&self) -> & Device <Ctx> Converts this type into a shared reference of the (usually inferred) input type.
Source § impl<'a> Deref for Device < CoreInternal <'a>> Source § type Target = Device < Core <'a>> The resulting type after dereferencing. Source § fn deref (&self) -> &Self:: Target Dereferences the value. Source § impl<'a> Deref for Device < Core <'a>> Source § type Target = Device < Bound > The resulting type after dereferencing. Source § fn deref (&self) -> &Self:: Target Dereferences the value. Source § impl Deref for Device < BoundInternal > Source § type Target = Device < Bound > The resulting type after dereferencing.
Source § fn deref (&self) -> &Self:: Target Dereferences the value. Source § impl Deref for Device < Bound > Source § type Target = Device The resulting type after dereferencing. Source § fn deref (&self) -> &Self:: Target Dereferences the value. Source § impl From <& Device < Bound >> for ARef < Device > Source § fn from (dev: & Device < Bound >) -> Self Converts to this type from the input type. Source § impl From <& Device < BoundInternal >> for ARef < Device > Source § fn from (dev: & Device < BoundInternal >) -> Self Converts to this type from the input type.
Source § impl<'a> From <& Device < Core <'a>>> for ARef < Device > Source § fn from (dev: & Device < Core <'a>>) -> Self Converts to this type from the input type. Source § impl<'a> From <& Device < CoreInternal <'a>>> for ARef < Device > Source § fn from (dev: & Device < CoreInternal <'a>>) -> Self Converts to this type from the input type. Source § impl Send for Device Source § impl Sync for Device Source § impl Sync for Device < Bound > Auto Trait Implementations § § impl<Ctx = Normal > !
Freeze for Device <Ctx> § impl<Ctx = Normal > ! RefUnwindSafe for Device <Ctx> § impl<Ctx = Normal > ! Send for Device <Ctx> § impl<Ctx = Normal > ! Sync for Device <Ctx> § impl<Ctx = Normal > ! Unpin for Device <Ctx> § impl<Ctx = Normal > ! UnsafeUnpin for Device <Ctx> § impl<Ctx> UnwindSafe for Device <Ctx> where Ctx: UnwindSafe , Blanket Implementations § Source § impl<T> Any for T where T: 'static + ? Sized , Source § fn type_id (&self) -> TypeId Gets the TypeId of self .
Read more Source § impl<T> Borrow <T> for T where T: ? Sized , Source § fn borrow (&self) -> &T Immutably borrows from an owned value. Read more Source § impl<T> BorrowMut <T> for T where T: ? Sized , Source § fn borrow_mut (&mut self) -> &mut T Mutably borrows from an owned value. Read more Source § impl<ST, DT> CastableFrom <ST, Initialized , Initialized > for DT where ST: ? Sized , DT: ? Sized , Source § impl<ST, DT> CastableFrom <ST, Uninit , Uninit > for DT where ST: ?
Sized , DT: ? Sized , Source § impl<T> From <T> for T Source § fn from (t: T) -> T Returns the argument unchanged. Source § impl<T> Init <T> for T Source § fn chain <F>(self, f: F) -> ChainInit <Self, F, T, E> where F: FnOnce ( &mut T ) -> Result < () , E>, First initializes the value using self then calls the function f with the initialized value. Read more Source § impl<T, U> Into <U> for T where U: From <T>, Source § fn into (self) -> U Calls U::from(self) .
That is, this conversion is whatever the implementation of From <T> for U chooses to do. Source § impl<S, T> IntoSafeCast <T> for S where T: FromSafeCast <S>, Source § fn into_safe_cast (self) -> T Convert self into a T . This operation is guaranteed to be lossless. Source § impl<S, T> IntoSafeCastArch <T> for S where T: FromSafeCastArch <S>, Source § fn into_safe_cast_arch (self) -> T Convert self into a T . This operation is guaranteed to be lossless.
Source § impl<T> KnownSize for T Source § const MIN_SIZE : usize = const MIN_SIZE: usize = size_of::<T>(); Minimum size of this type known at compile-time. Source § const MIN_ALIGN : Alignment = const MIN_ALIGN: Alignment = Alignment::of::<T>(); Minimum alignment of this type known at compile-time. Source § fn size (_: *const T ) -> usize Get the size of an object of this type in bytes, with the metadata of the given pointer.
Source § impl<T> PinInit <T> for T Source § unsafe fn __init (self, slot: *mut T ) -> Result < () , ! > Initializes slot . Read more Source § fn pin_chain <F>(self, f: F) -> ChainPinInit <Self, F, T, E> where F: FnOnce ( Pin < &mut T >) -> Result < () , E>, First initializes the value using self then calls the function f with the initialized value. Read more Source § impl<T> Read < Exclusive , BecauseExclusive > for T where T: ?
Sized , Source § impl<P, T> Receiver for P where P: Deref <Target = T> + ? Sized , T: ? Sized , Source § type Target = T 🔬 This is a nightly-only experimental API. ( arbitrary_self_types ) The target type on which the method may be called. Source § impl<T, U> TryFrom <U> for T where U: Into <T>, Source § type Error = ! The type returned in the event of a conversion error. Source § fn try_fro
The rest of this page is on the live site.