Impl 'From<T>' for contrib 'Json', 'MsgPack'.

This commit is contained in:
Sergio Benitez 2021-03-04 03:09:22 -08:00
parent 630f2c1105
commit 148b01ce80
2 changed files with 12 additions and 0 deletions

View File

@ -201,6 +201,12 @@ impl<'r, T: Serialize> Responder<'r, 'static> for Json<T> {
} }
} }
impl<T> From<T> for Json<T> {
fn from(value: T) -> Self {
Json(value)
}
}
impl<T> Deref for Json<T> { impl<T> Deref for Json<T> {
type Target = T; type Target = T;

View File

@ -200,6 +200,12 @@ impl<'v, T: DeserializeOwned + Send> form::FromFormField<'v> for MsgPack<T> {
} }
} }
impl<T> From<T> for MsgPack<T> {
fn from(value: T) -> Self {
MsgPack(value)
}
}
impl<T> Deref for MsgPack<T> { impl<T> Deref for MsgPack<T> {
type Target = T; type Target = T;