summaryrefslogtreecommitdiff
path: root/src/collection/guard.rs
diff options
context:
space:
mode:
authorBotahamec <botahamec@outlook.com>2024-05-23 20:44:02 -0400
committerBotahamec <botahamec@outlook.com>2024-05-23 20:44:02 -0400
commitfd4ee65a78ecbf376d99377a367137b0b8cdad41 (patch)
tree663b211b0da02431b2d100a270d60d48eebbefb0 /src/collection/guard.rs
parent0926201a52f860b1f75dda2e9bd6d2e536cc5f68 (diff)
parent8ecf29cfe2a74d02b2c4bcb7f7ad1a811dc38dfe (diff)
Merge branch '0.2'
Diffstat (limited to 'src/collection/guard.rs')
-rw-r--r--src/collection/guard.rs33
1 files changed, 29 insertions, 4 deletions
diff --git a/src/collection/guard.rs b/src/collection/guard.rs
index 110a935..8857c5f 100644
--- a/src/collection/guard.rs
+++ b/src/collection/guard.rs
@@ -1,19 +1,44 @@
+use std::fmt::{Debug, Display};
use std::ops::{Deref, DerefMut};
-use crate::{key::Keyable, Lockable};
+use crate::key::Keyable;
use super::LockGuard;
-impl<'a, 'key: 'a, L: Lockable<'a>, Key: Keyable> Deref for LockGuard<'a, 'key, L, Key> {
- type Target = L::Output;
+impl<'key, Guard: Debug, Key: Keyable> Debug for LockGuard<'key, Guard, Key> {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ Debug::fmt(&**self, f)
+ }
+}
+
+impl<'key, Guard: Display, Key: Keyable> Display for LockGuard<'key, Guard, Key> {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ Display::fmt(&**self, f)
+ }
+}
+
+impl<'key, Guard, Key: Keyable> Deref for LockGuard<'key, Guard, Key> {
+ type Target = Guard;
fn deref(&self) -> &Self::Target {
&self.guard
}
}
-impl<'a, 'key: 'a, L: Lockable<'a>, Key: Keyable> DerefMut for LockGuard<'a, 'key, L, Key> {
+impl<'key, Guard, Key: Keyable> DerefMut for LockGuard<'key, Guard, Key> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.guard
}
}
+
+impl<'key, Guard, Key: Keyable> AsRef<Guard> for LockGuard<'key, Guard, Key> {
+ fn as_ref(&self) -> &Guard {
+ &self.guard
+ }
+}
+
+impl<'key, Guard, Key: Keyable> AsMut<Guard> for LockGuard<'key, Guard, Key> {
+ fn as_mut(&mut self) -> &mut Guard {
+ &mut self.guard
+ }
+}