diff options
| author | Mica White <botahamec@outlook.com> | 2024-03-09 17:26:09 -0500 |
|---|---|---|
| committer | Mica White <botahamec@outlook.com> | 2024-03-09 17:26:09 -0500 |
| commit | 0172ecb56f1f8c414ea16bee9865d23584d5894a (patch) | |
| tree | 71da2c8e990a053b546a02149efc4b9706131f0c /src | |
| parent | 6a54884b292987fc1371bf062c42e964b6a4b0fe (diff) | |
LockCollection docs
Diffstat (limited to 'src')
| -rw-r--r-- | src/collection.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/collection.rs b/src/collection.rs index 809f340..4b24a67 100644 --- a/src/collection.rs +++ b/src/collection.rs @@ -5,6 +5,7 @@ use std::{ use crate::{key::Keyable, lockable::Lockable}; +/// returns `true` if the list contains a duplicate fn contains_duplicates(l: &[usize]) -> bool { for i in 0..l.len() { for j in 0..l.len() { @@ -17,6 +18,11 @@ fn contains_duplicates(l: &[usize]) -> bool { false } +/// A type which can be locked. +/// +/// This could be a tuple of [`Lockable`] types, an array, or a `Vec`. But it +/// can be safely locked without causing a deadlock. To do this, it is very +/// important that no duplicate locks are included within. pub struct LockCollection<L> { collection: L, } |
