summaryrefslogtreecommitdiff
path: root/src/collection/ref.rs
diff options
context:
space:
mode:
authorMica White <botahamec@gmail.com>2024-12-25 11:17:35 -0500
committerMica White <botahamec@gmail.com>2024-12-25 11:17:35 -0500
commit657377311d3b041ac7b942e61ddbbe2861c494ec (patch)
tree5e041812c67e7ef0451b35d0b33ee90be28fbeaf /src/collection/ref.rs
parent7e2a3aa417beb33c76fe98fbe49515c524cb0183 (diff)
try_lock returns a Result
Diffstat (limited to 'src/collection/ref.rs')
-rw-r--r--src/collection/ref.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/collection/ref.rs b/src/collection/ref.rs
index b0b142e..1f19e4d 100644
--- a/src/collection/ref.rs
+++ b/src/collection/ref.rs
@@ -268,17 +268,17 @@ impl<'a, L: Lockable> RefLockCollection<'a, L> {
pub fn try_lock<'key: 'a, Key: Keyable + 'key>(
&'a self,
key: Key,
- ) -> Option<LockGuard<'key, L::Guard<'a>, Key>> {
+ ) -> Result<LockGuard<'key, L::Guard<'a>, Key>, Key> {
let guard = unsafe {
if !self.raw_try_lock() {
- return None;
+ return Err(key);
}
// safety: we've acquired the locks
self.data.guard()
};
- Some(LockGuard {
+ Ok(LockGuard {
guard,
key,
_phantom: PhantomData,