summaryrefslogtreecommitdiff
path: root/src/collection/owned.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/collection/owned.rs')
-rw-r--r--src/collection/owned.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/collection/owned.rs b/src/collection/owned.rs
index 69680f4..3ea08b5 100644
--- a/src/collection/owned.rs
+++ b/src/collection/owned.rs
@@ -243,17 +243,17 @@ impl<L: OwnedLockable> OwnedLockCollection<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,