From 0172ecb56f1f8c414ea16bee9865d23584d5894a Mon Sep 17 00:00:00 2001 From: Mica White Date: Sat, 9 Mar 2024 17:26:09 -0500 Subject: LockCollection docs --- src/collection.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/collection.rs') 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 { collection: L, } -- cgit v1.2.3