summaryrefslogtreecommitdiff
path: root/src/collection/ref.rs
diff options
context:
space:
mode:
authorBotahamec <botahamec@outlook.com>2024-05-22 17:27:35 -0400
committerBotahamec <botahamec@outlook.com>2024-05-22 17:27:35 -0400
commitef191a3e8ecf4093fcd08036e35012c1af173a08 (patch)
tree9a6986986ad8392ae147c64c436214fa290773d7 /src/collection/ref.rs
parentebbe3cfce28914d776f3e5f89894fab50911c57e (diff)
Documentation for types
Diffstat (limited to 'src/collection/ref.rs')
-rw-r--r--src/collection/ref.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/collection/ref.rs b/src/collection/ref.rs
index 329f0ae..2e2883a 100644
--- a/src/collection/ref.rs
+++ b/src/collection/ref.rs
@@ -1,12 +1,13 @@
use std::fmt::Debug;
use std::marker::PhantomData;
-use crate::{key::Keyable, lockable::Lock, Lockable, OwnedLockable, Sharable};
+use crate::lockable::{Lockable, OwnedLockable, RawLock, Sharable};
+use crate::Keyable;
use super::{LockGuard, RefLockCollection};
#[must_use]
-pub fn get_locks<L: Lockable>(data: &L) -> Vec<&dyn Lock> {
+pub fn get_locks<L: Lockable>(data: &L) -> Vec<&dyn RawLock> {
let mut locks = Vec::new();
data.get_ptrs(&mut locks);
locks.sort_by_key(|lock| std::ptr::from_ref(*lock));
@@ -15,7 +16,7 @@ pub fn get_locks<L: Lockable>(data: &L) -> Vec<&dyn Lock> {
/// returns `true` if the sorted list contains a duplicate
#[must_use]
-fn contains_duplicates(l: &[&dyn Lock]) -> bool {
+fn contains_duplicates(l: &[&dyn RawLock]) -> bool {
l.windows(2)
.any(|window| std::ptr::eq(window[0], window[1]))
}
@@ -43,7 +44,7 @@ unsafe impl<'c, L: Lockable> Lockable for RefLockCollection<'c, L> {
type ReadGuard<'g> = L::ReadGuard<'g> where Self: 'g;
- fn get_ptrs<'a>(&'a self, ptrs: &mut Vec<&'a dyn Lock>) {
+ fn get_ptrs<'a>(&'a self, ptrs: &mut Vec<&'a dyn RawLock>) {
ptrs.extend_from_slice(&self.locks);
}