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.