summaryrefslogtreecommitdiff
path: root/src/collection/boxed.rs
diff options
context:
space:
mode:
authorMica White <botahamec@gmail.com>2024-12-25 11:17:35 -0500
committerMica White <botahamec@gmail.com>2024-12-25 11:17:35 -0500
commit657377311d3b041ac7b942e61ddbbe2861c494ec (patch)
tree5e041812c67e7ef0451b35d0b33ee90be28fbeaf /src/collection/boxed.rs
parent7e2a3aa417beb33c76fe98fbe49515c524cb0183 (diff)
try_lock returns a Result
Diffstat (limited to 'src/collection/boxed.rs')
-rw-r--r--src/collection/boxed.rs6
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,