Skip to content

Commit d9b62aa

Browse files
committed
refactor(ref): implement borrow and as_ptr via RestrictAccess
Signed-off-by: Martin Kröning <martin.kroening@eonerc.rwth-aachen.de>
1 parent 5324d38 commit d9b62aa

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/volatile_ref.rs

Lines changed: 4 additions & 4 deletions
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)