summaryrefslogtreecommitdiff
path: root/src/collection
diff options
context:
space:
mode:
authorMica White <botahamec@outlook.com>2025-12-08 20:03:40 -0500
committerMica White <botahamec@outlook.com>2025-12-08 20:03:40 -0500
commit8be852662a432d96553fcf7a9fc57c4f3c92baae (patch)
tree90c93f4d9d24538c64c7552a83ef8ae29172e78a /src/collection
parent17dab88a7b4bc86cf156a1e0ac1bac19e6f9f5c6 (diff)
Stuff
Diffstat (limited to 'src/collection')
-rwxr-xr-x[-rw-r--r--]src/collection/boxed.rs16
-rwxr-xr-x[-rw-r--r--]src/collection/guard.rs0
-rwxr-xr-x[-rw-r--r--]src/collection/owned.rs16
-rwxr-xr-x[-rw-r--r--]src/collection/ref.rs16
-rwxr-xr-x[-rw-r--r--]src/collection/retry.rs16
-rwxr-xr-x[-rw-r--r--]src/collection/utils.rs0
6 files changed, 48 insertions, 16 deletions
diff --git a/src/collection/boxed.rs b/src/collection/boxed.rs
index 7767b31..3708c8b 100644..100755
--- a/src/collection/boxed.rs
+++ b/src/collection/boxed.rs
@@ -361,14 +361,18 @@ impl<L: Lockable> BoxedLockCollection<L> {
}
}
- pub fn scoped_lock<'a, R>(&'a self, key: impl Keyable, f: impl Fn(L::DataMut<'a>) -> R) -> R {
+ pub fn scoped_lock<'a, R>(
+ &'a self,
+ key: impl Keyable,
+ f: impl FnOnce(L::DataMut<'a>) -> R,
+ ) -> R {
scoped_write(self, key, f)
}
pub fn scoped_try_lock<'a, Key: Keyable, R>(
&'a self,
key: Key,
- f: impl Fn(L::DataMut<'a>) -> R,
+ f: impl FnOnce(L::DataMut<'a>) -> R,
) -> Result<R, Key> {
scoped_try_write(self, key, f)
}
@@ -473,14 +477,18 @@ impl<L: Lockable> BoxedLockCollection<L> {
}
impl<L: Sharable> BoxedLockCollection<L> {
- pub fn scoped_read<'a, R>(&'a self, key: impl Keyable, f: impl Fn(L::DataRef<'a>) -> R) -> R {
+ pub fn scoped_read<'a, R>(
+ &'a self,
+ key: impl Keyable,
+ f: impl FnOnce(L::DataRef<'a>) -> R,
+ ) -> R {
scoped_read(self, key, f)
}
pub fn scoped_try_read<'a, Key: Keyable, R>(
&'a self,
key: Key,
- f: impl Fn(L::DataRef<'a>) -> R,
+ f: impl FnOnce(L::DataRef<'a>) -> R,
) -> Result<R, Key> {
scoped_try_read(self, key, f)
}
diff --git a/src/collection/guard.rs b/src/collection/guard.rs
index ab66ffe..ab66ffe 100644..100755
--- a/src/collection/guard.rs
+++ b/src/collection/guard.rs
diff --git a/src/collection/owned.rs b/src/collection/owned.rs
index 38e6a16..d6889d1 100644..100755
--- a/src/collection/owned.rs
+++ b/src/collection/owned.rs
@@ -189,14 +189,18 @@ impl<L: OwnedLockable> OwnedLockCollection<L> {
Self { data }
}
- pub fn scoped_lock<'a, R>(&'a self, key: impl Keyable, f: impl Fn(L::DataMut<'a>) -> R) -> R {
+ pub fn scoped_lock<'a, R>(
+ &'a self,
+ key: impl Keyable,
+ f: impl FnOnce(L::DataMut<'a>) -> R,
+ ) -> R {
scoped_write(self, key, f)
}
pub fn scoped_try_lock<'a, Key: Keyable, R>(
&'a self,
key: Key,
- f: impl Fn(L::DataMut<'a>) -> R,
+ f: impl FnOnce(L::DataMut<'a>) -> R,
) -> Result<R, Key> {
scoped_try_write(self, key, f)
}
@@ -304,14 +308,18 @@ impl<L: OwnedLockable> OwnedLockCollection<L> {
}
impl<L: Sharable> OwnedLockCollection<L> {
- pub fn scoped_read<'a, R>(&'a self, key: impl Keyable, f: impl Fn(L::DataRef<'a>) -> R) -> R {
+ pub fn scoped_read<'a, R>(
+ &'a self,
+ key: impl Keyable,
+ f: impl FnOnce(L::DataRef<'a>) -> R,
+ ) -> R {
scoped_read(self, key, f)
}
pub fn scoped_try_read<'a, Key: Keyable, R>(
&'a self,
key: Key,
- f: impl Fn(L::DataRef<'a>) -> R,
+ f: impl FnOnce(L::DataRef<'a>) -> R,
) -> Result<R, Key> {
scoped_try_read(self, key, f)
}
diff --git a/src/collection/ref.rs b/src/collection/ref.rs
index e71624d..d180ab0 100644..100755
--- a/src/collection/ref.rs
+++ b/src/collection/ref.rs
@@ -240,14 +240,18 @@ impl<'a, L: Lockable> RefLockCollection<'a, L> {
Some(Self { data, locks })
}
- pub fn scoped_lock<'s, R>(&'s self, key: impl Keyable, f: impl Fn(L::DataMut<'s>) -> R) -> R {
+ pub fn scoped_lock<'s, R>(
+ &'s self,
+ key: impl Keyable,
+ f: impl FnOnce(L::DataMut<'s>) -> R,
+ ) -> R {
scoped_write(self, key, f)
}
pub fn scoped_try_lock<'s, Key: Keyable, R>(
&'s self,
key: Key,
- f: impl Fn(L::DataMut<'s>) -> R,
+ f: impl FnOnce(L::DataMut<'s>) -> R,
) -> Result<R, Key> {
scoped_try_write(self, key, f)
}
@@ -355,14 +359,18 @@ impl<'a, L: Lockable> RefLockCollection<'a, L> {
}
impl<L: Sharable> RefLockCollection<'_, L> {
- pub fn scoped_read<'a, R>(&'a self, key: impl Keyable, f: impl Fn(L::DataRef<'a>) -> R) -> R {
+ pub fn scoped_read<'a, R>(
+ &'a self,
+ key: impl Keyable,
+ f: impl FnOnce(L::DataRef<'a>) -> R,
+ ) -> R {
scoped_read(self, key, f)
}
pub fn scoped_try_read<'a, Key: Keyable, R>(
&'a self,
key: Key,
- f: impl Fn(L::DataRef<'a>) -> R,
+ f: impl FnOnce(L::DataRef<'a>) -> R,
) -> Result<R, Key> {
scoped_try_read(self, key, f)
}
diff --git a/src/collection/retry.rs b/src/collection/retry.rs
index 15f626d..e127c20 100644..100755
--- a/src/collection/retry.rs
+++ b/src/collection/retry.rs
@@ -534,14 +534,18 @@ impl<L: Lockable> RetryingLockCollection<L> {
(!contains_duplicates(&data)).then_some(unsafe { Self::new_unchecked(data) })
}
- pub fn scoped_lock<'a, R>(&'a self, key: impl Keyable, f: impl Fn(L::DataMut<'a>) -> R) -> R {
+ pub fn scoped_lock<'a, R>(
+ &'a self,
+ key: impl Keyable,
+ f: impl FnOnce(L::DataMut<'a>) -> R,
+ ) -> R {
scoped_write(self, key, f)
}
pub fn scoped_try_lock<'a, Key: Keyable, R>(
&'a self,
key: Key,
- f: impl Fn(L::DataMut<'a>) -> R,
+ f: impl FnOnce(L::DataMut<'a>) -> R,
) -> Result<R, Key> {
scoped_try_write(self, key, f)
}
@@ -649,14 +653,18 @@ impl<L: Lockable> RetryingLockCollection<L> {
}
impl<L: Sharable> RetryingLockCollection<L> {
- pub fn scoped_read<'a, R>(&'a self, key: impl Keyable, f: impl Fn(L::DataRef<'a>) -> R) -> R {
+ pub fn scoped_read<'a, R>(
+ &'a self,
+ key: impl Keyable,
+ f: impl FnOnce(L::DataRef<'a>) -> R,
+ ) -> R {
scoped_read(self, key, f)
}
pub fn scoped_try_read<'a, Key: Keyable, R>(
&'a self,
key: Key,
- f: impl Fn(L::DataRef<'a>) -> R,
+ f: impl FnOnce(L::DataRef<'a>) -> R,
) -> Result<R, Key> {
scoped_try_read(self, key, f)
}
diff --git a/src/collection/utils.rs b/src/collection/utils.rs
index 71a023e..71a023e 100644..100755
--- a/src/collection/utils.rs
+++ b/src/collection/utils.rs