Skip to content

Commit cb0fc46

Browse files
committed
Add a new_read_only convenience function
1 parent f21ef3f commit cb0fc46

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/ptr.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@ where
131131
unsafe { VolatilePtr::new(reference.into()) }
132132
}
133133

134+
pub const unsafe fn new_read_only(pointer: NonNull<T>) -> VolatilePtr<'a, T, ReadOnly> {
135+
unsafe { Self::new_restricted(ReadOnly, pointer) }
136+
}
137+
134138
pub const unsafe fn new_restricted<A>(access: A, pointer: NonNull<T>) -> VolatilePtr<'a, T, A>
135139
where
136140
A: Access,

0 commit comments

Comments
 (0)