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