1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-12-17 13:46:36 +00:00

PathDeserializer: use deserialize_str for deserialize_any

This commit is contained in:
Valentin Leistner 2022-09-18 02:33:27 +02:00 committed by valentinleistner
parent fd63305859
commit ae2ee7fff1

View file

@ -23,6 +23,9 @@ macro_rules! unsupported_type {
macro_rules! parse_single_value { macro_rules! parse_single_value {
($trait_fn:ident) => { ($trait_fn:ident) => {
parse_single_value!($trait_fn, $trait_fn);
};
($trait_fn:ident, $visit_fn:ident) => {
fn $trait_fn<V>(self, visitor: V) -> Result<V::Value, Self::Error> fn $trait_fn<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where where
V: Visitor<'de>, V: Visitor<'de>,
@ -39,7 +42,7 @@ macro_rules! parse_single_value {
Value { Value {
value: &self.path[0], value: &self.path[0],
} }
.$trait_fn(visitor) .$visit_fn(visitor)
} }
} }
}; };
@ -201,11 +204,11 @@ impl<'de, T: ResourcePath + 'de> Deserializer<'de> for PathDeserializer<'de, T>
}) })
} }
unsupported_type!(deserialize_any, "'any'");
unsupported_type!(deserialize_option, "Option<T>"); unsupported_type!(deserialize_option, "Option<T>");
unsupported_type!(deserialize_identifier, "identifier"); unsupported_type!(deserialize_identifier, "identifier");
unsupported_type!(deserialize_ignored_any, "ignored_any"); unsupported_type!(deserialize_ignored_any, "ignored_any");
parse_single_value!(deserialize_any, deserialize_str);
parse_single_value!(deserialize_bool); parse_single_value!(deserialize_bool);
parse_single_value!(deserialize_i8); parse_single_value!(deserialize_i8);
parse_single_value!(deserialize_i16); parse_single_value!(deserialize_i16);