Implement DerefMut and AsMut for Json
-use std::ops::Deref;
+use std::ops::{Deref, DerefMut};
use serde::{Deserialize, Serialize};
use serde_json::value::RawValue as JsonRawValue;
@@ -24,12 +24,24 @@ impl<T> Deref for Json<T> {
}
}
+impl<T> DerefMut for Json<T> {
+ fn deref_mut(&mut self) -> &mut Self::Target {
+ &mut self.0
+ }
+}
+
impl<T> AsRef<T> for Json<T> {
fn as_ref(&self) -> &T {
&self.0
}
}
+impl<T> AsMut<T> for Json<T> {
+ fn as_mut(&mut self) -> &mut T {
+ &mut self.0
+ }
+}
+
impl<DB> Type<DB> for JsonValue
where
Json<Self>: Type<DB>,
