mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-03-19 08:39:44 +00:00
Add From impls for Json
This commit is contained in:
committed by
Austin Bonander
parent
5a8cd959c2
commit
0b192cfda6
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user