http_serde_ext/uri.rs
1use serde::Serializer;
2
3type Type = http::Uri;
4const EXPECT_MESSAGE: &str = "a uri string";
5
6pub fn serialize<S: Serializer>(val: &Type, ser: S) -> Result<S::Ok, S::Error> {
7 ser.collect_str(val)
8}
9
10create_visitor!(
11 Visitor,
12 Type,
13 EXPECT_MESSAGE,
14 (visit_str, &str),
15 (visit_string, String)
16);
17deserialize_string!(Visitor, Type);
18
19derive_extension_types!(super::Type);
20derive_hash_types!(super::Type);