diff options
Diffstat (limited to 'src/collection/ref.rs')
| -rw-r--r-- | src/collection/ref.rs | 6 |
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, |
