Add From impls for Json

This commit is contained in:
Daniel Beckwith 2022-11-24 22:02:14 +00:00 committed by Austin Bonander
parent 5a8cd959c2
commit 0b192cfda6

View File

@ -57,6 +57,18 @@ use crate::types::Type;
#[serde(transparent)]
pub struct Json<T: ?Sized>(pub T);
impl<T> From<T> for Json<T> {
fn from(value: T) -> Self {
Self(value)
}
}
impl<T> From<Json<T>> for T {
fn from(Json(value): Json<T>) -> Self {
value
}
}
impl<T> Deref for Json<T> {
type Target = T;