Browse Source

Add Deref and DerefMut impls to Serialized<T>.

Kestrel 2 months ago
parent
commit
6c079dcad6
1 changed files with 15 additions and 0 deletions
  1. 15 0
      microrm/src/schema.rs

+ 15 - 0
microrm/src/schema.rs

@@ -161,6 +161,21 @@ impl<T: serde::Serialize + serde::de::DeserializeOwned + Clone> AsMut<T> for Ser
     }
     }
 }
 }
 
 
+impl<T: serde::Serialize + serde::de::DeserializeOwned + Clone> std::ops::Deref for Serialized<T> {
+    type Target = T;
+    fn deref(&self) -> &Self::Target {
+        &self.wrapped
+    }
+}
+
+impl<T: serde::Serialize + serde::de::DeserializeOwned + Clone> std::ops::DerefMut
+    for Serialized<T>
+{
+    fn deref_mut(&mut self) -> &mut Self::Target {
+        &mut self.wrapped
+    }
+}
+
 impl<T: 'static + serde::Serialize + serde::de::DeserializeOwned + std::fmt::Debug + Clone> Datum
 impl<T: 'static + serde::Serialize + serde::de::DeserializeOwned + std::fmt::Debug + Clone> Datum
     for Serialized<T>
     for Serialized<T>
 {
 {