mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-12-29 21:00:54 +00:00
Add From impls for Json
This commit is contained in:
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;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user