diff options
Diffstat (limited to 'src/collection/boxed.rs')
| -rw-r--r-- | src/collection/boxed.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/collection/boxed.rs b/src/collection/boxed.rs index 0014cc3..6db0683 100644 --- a/src/collection/boxed.rs +++ b/src/collection/boxed.rs @@ -372,17 +372,17 @@ impl<L: Lockable> BoxedLockCollection<L> { pub fn try_lock<'g, 'key: 'g, Key: Keyable + 'key>( &'g self, key: Key, - ) -> Option<LockGuard<'key, L::Guard<'g>, Key>> { + ) -> Result<LockGuard<'key, L::Guard<'g>, 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, |
