From 97f973d685baf389dcde08044dd3dfb7ba556050 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sat, 6 Apr 2024 14:17:30 +0200 Subject: refactor(ecs): fix Clippy lints --- ecs/src/lock.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'ecs/src/lock.rs') diff --git a/ecs/src/lock.rs b/ecs/src/lock.rs index ff46761..c8a8495 100644 --- a/ecs/src/lock.rs +++ b/ecs/src/lock.rs @@ -20,6 +20,10 @@ where Self { inner: RwLock::new(value) } } + /// Tries to a acquire a handle to the resource with read access. + /// + /// # Errors + /// Returns `Err` if unavailable (A mutable handle is hold). pub fn read_nonblock(&self) -> Result, Error> { let guard = self.inner.try_read().or_else(|err| match err { @@ -33,6 +37,10 @@ where Ok(ReadGuard { inner: guard }) } + /// Tries to a acquire a handle to the resource with mutable access. + /// + /// # Errors + /// Returns `Err` if unavailable (A mutable or immutable handle is hold). pub fn write_nonblock(&self) -> Result, Error> { let guard = self.inner.try_write().or_else(|err| match err { -- cgit v1.2.3-18-g5258