Support let sender: &UserId = value.get("sender").try_into()?;
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
7f345bf39d
commit
f485a0265c
@ -586,6 +586,42 @@ fn expand_checked_impls(input: &ItemStruct, validate: Path) -> TokenStream {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[automatically_derived]
|
||||||
|
impl<'a, #generic_params> std::convert::TryFrom<&'a serde_json::Value> for &'a #id_ty {
|
||||||
|
type Error = crate::IdParseError;
|
||||||
|
|
||||||
|
fn try_from(v: &'a serde_json::Value) -> Result<Self, Self::Error> {
|
||||||
|
v.as_str().unwrap_or_default().try_into()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[automatically_derived]
|
||||||
|
impl<'a, #generic_params> std::convert::TryFrom<&'a crate::CanonicalJsonValue> for &'a #id_ty {
|
||||||
|
type Error = crate::IdParseError;
|
||||||
|
|
||||||
|
fn try_from(v: &'a crate::CanonicalJsonValue) -> Result<Self, Self::Error> {
|
||||||
|
v.as_str().unwrap_or_default().try_into()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[automatically_derived]
|
||||||
|
impl<'a, #generic_params> std::convert::TryFrom<Option<&'a serde_json::Value>> for &'a #id_ty {
|
||||||
|
type Error = crate::IdParseError;
|
||||||
|
|
||||||
|
fn try_from(v: Option<&'a serde_json::Value>) -> Result<Self, Self::Error> {
|
||||||
|
v.and_then(|v| v.as_str()).unwrap_or_default().try_into()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[automatically_derived]
|
||||||
|
impl<'a, #generic_params> std::convert::TryFrom<Option<&'a crate::CanonicalJsonValue>> for &'a #id_ty {
|
||||||
|
type Error = crate::IdParseError;
|
||||||
|
|
||||||
|
fn try_from(v: Option<&'a crate::CanonicalJsonValue>) -> Result<Self, Self::Error> {
|
||||||
|
v.and_then(|v| v.as_str()).unwrap_or_default().try_into()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[automatically_derived]
|
#[automatically_derived]
|
||||||
impl #impl_generics std::str::FromStr for Box<#id_ty> {
|
impl #impl_generics std::str::FromStr for Box<#id_ty> {
|
||||||
type Err = crate::IdParseError;
|
type Err = crate::IdParseError;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user