Skip to content

Commit

Permalink
add Scheme and PathAndQuery
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtoth committed Oct 25, 2023
1 parent 699bb7a commit 80ee8b2
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
//! - [`HeaderName`](header_name)
//! - [`HeaderValue`](header_value)
//! - [`uri::Authority`](authority)
//! - [`uri::Scheme`](scheme)
//! - [`uri::PathAndQuery`](path_and_query)
//! - [`Version`](version)
//! - Generic [`HeaderMap<T>`](header_map_generic) where the item is not a `HeaderValue`
//!
Expand Down Expand Up @@ -118,8 +120,10 @@ doc_mod!(HeaderMap, header_map_generic, U);
doc_mod!(HeaderName, header_name);
doc_mod!(HeaderValue, header_value);
doc_mod!(Method, method);
doc_mod!(PathAndQuery, path_and_query; "uri::");
doc_mod!(Request, request, U);
doc_mod!(Response, response, U);
doc_mod!(Scheme, scheme; "uri::");
doc_mod!(StatusCode, status_code);
doc_mod!(Uri, uri);
doc_mod!(Version, version);
14 changes: 14 additions & 0 deletions src/path_and_query.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
type Type = http::uri::PathAndQuery;
const EXPECT_MESSAGE: &str = "valid path and query";

serialize_str!(Type);
create_visitor!(
Visitor,
Type,
EXPECT_MESSAGE,
(visit_str, &str),
(visit_string, String)
);
deserialize_string!(Visitor, Type);

derive_extension_types!(super::Type);
8 changes: 8 additions & 0 deletions src/scheme.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
type Type = http::uri::Scheme;
const EXPECT_MESSAGE: &str = "valid scheme";

serialize_str!(Type);
create_visitor!(Visitor, Type, EXPECT_MESSAGE, (visit_str, &str));
deserialize_str!(Visitor, Type);

derive_extension_types!(super::Type);

0 comments on commit 80ee8b2

Please sign in to comment.