diff options
author | HampusM <hampus@hampusmat.com> | 2024-04-06 14:17:30 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2024-04-06 14:17:30 +0200 |
commit | 97f973d685baf389dcde08044dd3dfb7ba556050 (patch) | |
tree | 63e67bf212aabd653b5344fd773212e11afd4ae9 /ecs/src/lock.rs | |
parent | 407612918489bfa642e2d653edbb54272b3f00f5 (diff) |
refactor(ecs): fix Clippy lints
Diffstat (limited to 'ecs/src/lock.rs')
-rw-r--r-- | ecs/src/lock.rs | 8 |
1 files changed, 8 insertions, 0 deletions
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<ReadGuard<Value>, 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<WriteGuard<Value>, Error> { let guard = self.inner.try_write().or_else(|err| match err { |