Lines Matching defs:T
24 struct Inner<T: Send> {
26 data: Revocable<T>,
49 /// [`Devres`] users should make sure to simply free the corresponding backing resource in `T`'s
108 pub struct Devres<T: Send> {
121 inner: Opaque<Inner<T>>,
125 impl<T: Send> Devres<T> {
132 data: impl PinInit<T, E> + 'a,
135 T: 'a,
165 // SAFETY: `inner` is a valid pointer to an `Inner<T>` and valid for both reads
173 fn inner(&self) -> &Inner<T> {
179 fn data(&self) -> &Revocable<T> {
187 let inner = unsafe { &*ptr.cast::<Inner<T>>() };
219 /// Obtain `&'a T`, bypassing the [`Revocable`].
221 /// This method allows to directly obtain a `&'a T`, bypassing the [`Revocable`], by presenting
247 pub fn access<'a>(&'a self, dev: &'a Device<Bound>) -> Result<&'a T> {
259 pub fn try_access(&self) -> Option<RevocableGuard<'_, T>> {
264 pub fn try_access_with<R, F: FnOnce(&T) -> R>(&self, f: F) -> Option<R> {
269 pub fn try_access_with_guard<'a>(&'a self, guard: &'a rcu::Guard) -> Option<&'a T> {
274 // SAFETY: `Devres` can be send to any task, if `T: Send`.
275 unsafe impl<T: Send> Send for Devres<T> {}
277 // SAFETY: `Devres` can be shared with any task, if `T: Sync`.
278 unsafe impl<T: Send + Sync> Sync for Devres<T> {}
281 impl<T: Send> PinnedDrop for Devres<T> {
359 pub fn register<T, E>(dev: &Device<Bound>, data: impl PinInit<T, E>, flags: Flags) -> Result
361 T: Send + 'static,