pub struct DevresLt<F: ForLt>(/* private fields */)
where
for<'a> F::Of<'a>: Send;Expand description
Device-managed resource with ForLt-aware access.
DevresLt wraps Devres and shortens the stored 'static lifetime to the caller’s borrow
lifetime in all access methods.
Types that implement CovariantForLt get direct-reference accessors (Self::access,
Self::try_access). Plain ForLt types use closure-based accessors
(Self::access_with, Self::try_access_with).
Implementations§
Source§impl<F: ForLt> DevresLt<F>
impl<F: ForLt> DevresLt<F>
Sourcepub unsafe fn new<'a, E>(
dev: &'a Device<Bound>,
data: impl PinInit<F::Of<'a>, E>,
) -> Result<Self>
pub unsafe fn new<'a, E>( dev: &'a Device<Bound>, data: impl PinInit<F::Of<'a>, E>, ) -> Result<Self>
Sourcepub fn access_with<R, G>(&self, dev: &Device<Bound>, f: G) -> Result<R>
pub fn access_with<R, G>(&self, dev: &Device<Bound>, f: G) -> Result<R>
Obtain &F::Of<'_>, bypassing the Revocable, through a closure.
This method works like DevresLt::access but accepts any
ForLt type, not just CovariantForLt.
Sourcepub fn try_access_with<R, G>(&self, f: G) -> Option<R>
pub fn try_access_with<R, G>(&self, f: G) -> Option<R>
DevresLt accessor for Revocable::try_access_with.
Source§impl<F: CovariantForLt> DevresLt<F>
impl<F: CovariantForLt> DevresLt<F>
Sourcepub fn access<'a>(&'a self, dev: &'a Device<Bound>) -> Result<&'a F::Of<'a>>
pub fn access<'a>(&'a self, dev: &'a Device<Bound>) -> Result<&'a F::Of<'a>>
Obtain &'a F::Of<'a>, bypassing the Revocable.
This method works like Devres::access, but shortens the returned reference’s lifetime
from 'static to 'a via CovariantForLt::cast_ref.
Sourcepub fn try_access(&self) -> Option<DevresGuard<'_, F>>
pub fn try_access(&self) -> Option<DevresGuard<'_, F>>
DevresLt accessor for Revocable::try_access.
Auto Trait Implementations§
impl<F> !RefUnwindSafe for DevresLt<F>
impl<F> !UnwindSafe for DevresLt<F>
impl<F> Freeze for DevresLt<F>
impl<F> Send for DevresLt<F>
impl<F> Sync for DevresLt<F>
impl<F> Unpin for DevresLt<F>
impl<F> UnsafeUnpin for DevresLt<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> 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