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/ref.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/collection/ref.rs') 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, 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