summaryrefslogtreecommitdiff
path: root/src/collection/guard.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/collection/guard.rs')
-rw-r--r--src/collection/guard.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/collection/guard.rs b/src/collection/guard.rs
index b8561eb..8857c5f 100644
--- a/src/collection/guard.rs
+++ b/src/collection/guard.rs
@@ -1,9 +1,22 @@
+use std::fmt::{Debug, Display};
use std::ops::{Deref, DerefMut};
use crate::key::Keyable;
use super::LockGuard;
+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;
@@ -17,3 +30,15 @@ impl<'key, Guard, Key: Keyable> DerefMut for LockGuard<'key, Guard, Key> {
&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
+ }
+}