|
|
|
@ -134,7 +134,7 @@ pub fn deserialize_from_str< |
|
|
|
deserializer: D, |
|
|
|
deserializer: D, |
|
|
|
) -> Result<T, D::Error> { |
|
|
|
) -> Result<T, D::Error> { |
|
|
|
struct Visitor<T: FromStr<Err = E>, E>(std::marker::PhantomData<T>); |
|
|
|
struct Visitor<T: FromStr<Err = E>, E>(std::marker::PhantomData<T>); |
|
|
|
impl<'de, T: FromStr<Err = Err>, Err: fmt::Display> serde::de::Visitor<'de> for Visitor<T, Err> { |
|
|
|
impl<T: FromStr<Err = Err>, Err: fmt::Display> serde::de::Visitor<'_> for Visitor<T, Err> { |
|
|
|
type Value = T; |
|
|
|
type Value = T; |
|
|
|
fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { |
|
|
|
fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { |
|
|
|
write!(formatter, "a parsable string") |
|
|
|
write!(formatter, "a parsable string") |
|
|
|
@ -156,7 +156,7 @@ pub fn deserialize_from_str< |
|
|
|
/// string when passed to a format string.
|
|
|
|
/// string when passed to a format string.
|
|
|
|
pub struct HtmlEscape<'a>(pub &'a str); |
|
|
|
pub struct HtmlEscape<'a>(pub &'a str); |
|
|
|
|
|
|
|
|
|
|
|
impl<'a> fmt::Display for HtmlEscape<'a> { |
|
|
|
impl fmt::Display for HtmlEscape<'_> { |
|
|
|
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { |
|
|
|
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { |
|
|
|
// Because the internet is always right, turns out there's not that many
|
|
|
|
// Because the internet is always right, turns out there's not that many
|
|
|
|
// characters to escape: http://stackoverflow.com/questions/7381974
|
|
|
|
// characters to escape: http://stackoverflow.com/questions/7381974
|
|
|
|
|