Skip to content

Commit e4c858d

Browse files
committed
refactor(ref): implement borrow and as_ptr via RestrictAccess
Signed-off-by: Martin Kröning <[email protected]>
1 parent e632902 commit e4c858d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/volatile_ref.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ where
139139
/// This method creates a `VolatileRef` tied to the lifetime of the `&VolatileRef` it is created from.
140140
/// This is useful for providing a volatile reference without moving the original `VolatileRef`.
141141
/// In comparison with creating a `&VolatileRef<'a, T>`, this avoids the additional indirection and lifetime.
142-
pub fn borrow(&self) -> VolatileRef<'_, T, A::RestrictShared>
142+
pub fn borrow(&self) -> VolatileRef<'_, T, A::Restricted>
143143
where
144-
A: Access,
144+
A: RestrictAccess<ReadOnly>,
145145
{
146146
unsafe { VolatileRef::new_restricted(Default::default(), self.pointer) }
147147
}
@@ -161,9 +161,9 @@ where
161161
/// Borrows this `VolatileRef` as a read-only [`VolatilePtr`].
162162
///
163163
/// Use this method to do (partial) volatile reads of the referenced data.
164-
pub fn as_ptr(&self) -> VolatilePtr<'_, T, A::RestrictShared>
164+
pub fn as_ptr(&self) -> VolatilePtr<'_, T, A::Restricted>
165165
where
166-
A: Access,
166+
A: RestrictAccess<ReadOnly>,
167167
{
168168
unsafe { VolatilePtr::new_restricted(Default::default(), self.pointer) }
169169
}

0 commit comments

Comments
 (0)