From 657377311d3b041ac7b942e61ddbbe2861c494ec Mon Sep 17 00:00:00 2001 From: Mica White Date: Wed, 25 Dec 2024 11:17:35 -0500 Subject: try_lock returns a Result --- src/collection/owned.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/collection/owned.rs') 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 OwnedLockCollection { pub fn try_lock<'g, 'key: 'g, Key: Keyable + 'key>( &'g self, key: Key, - ) -> Option, Key>> { + ) -> Result, 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, -- cgit v1.2.3