summaryrefslogtreecommitdiff
path: root/src/rwlock
diff options
context:
space:
mode:
Diffstat (limited to 'src/rwlock')
-rw-r--r--src/rwlock/read_guard.rs4
-rw-r--r--src/rwlock/read_lock.rs2
-rw-r--r--src/rwlock/write_guard.rs4
3 files changed, 7 insertions, 3 deletions
diff --git a/src/rwlock/read_guard.rs b/src/rwlock/read_guard.rs
index da3d101..e46078c 100644
--- a/src/rwlock/read_guard.rs
+++ b/src/rwlock/read_guard.rs
@@ -46,7 +46,9 @@ impl<'a, T: ?Sized + 'a, R: RawRwLock> Drop for RwLockReadRef<'a, T, R> {
}
impl<'a, T: ?Sized + 'a, R: RawRwLock> RwLockReadRef<'a, T, R> {
- pub unsafe fn new(mutex: &'a RwLock<T, R>) -> Self {
+ /// Creates an immutable reference for the underlying data of an [`RwLock`]
+ /// without locking it or taking ownership of the key.
+ pub(crate) unsafe fn new(mutex: &'a RwLock<T, R>) -> Self {
Self(mutex, PhantomData)
}
}
diff --git a/src/rwlock/read_lock.rs b/src/rwlock/read_lock.rs
index 29042b5..4f2bc86 100644
--- a/src/rwlock/read_lock.rs
+++ b/src/rwlock/read_lock.rs
@@ -36,7 +36,7 @@ impl<'l, T, R> From<&'l RwLock<T, R>> for ReadLock<'l, T, R> {
impl<'l, T: ?Sized, R> AsRef<RwLock<T, R>> for ReadLock<'l, T, R> {
fn as_ref(&self) -> &RwLock<T, R> {
- &self.0
+ self.0
}
}
diff --git a/src/rwlock/write_guard.rs b/src/rwlock/write_guard.rs
index c8dd58b..ec622d7 100644
--- a/src/rwlock/write_guard.rs
+++ b/src/rwlock/write_guard.rs
@@ -48,7 +48,9 @@ impl<'a, T: ?Sized + 'a, R: RawRwLock> Drop for RwLockWriteRef<'a, T, R> {
}
impl<'a, T: ?Sized + 'a, R: RawRwLock> RwLockWriteRef<'a, T, R> {
- pub unsafe fn new(mutex: &'a RwLock<T, R>) -> Self {
+ /// Creates a reference to the underlying data of an [`RwLock`] without
+ /// locking or taking ownership of the key.
+ pub(crate) unsafe fn new(mutex: &'a RwLock<T, R>) -> Self {
Self(mutex, PhantomData)
}
}