Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(lib): use non_exhaustive macro for future field expanding instead of manual implementation #678

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/request.rs
Expand Up @@ -165,6 +165,7 @@ pub struct Request<T> {
/// The HTTP request head consists of a method, uri, version, and a set of
/// header fields.
#[derive(Clone)]
#[non_exhaustive]
pub struct Parts {
/// The request's method
pub method: Method,
Expand All @@ -180,8 +181,6 @@ pub struct Parts {

/// The request's extensions
pub extensions: Extensions,

_priv: (),
}

/// An HTTP request builder
Expand Down Expand Up @@ -715,7 +714,6 @@ impl Parts {
version: Version::default(),
headers: HeaderMap::default(),
extensions: Extensions::default(),
_priv: (),
}
}
}
Expand Down
5 changes: 1 addition & 4 deletions src/response.rs
Expand Up @@ -187,6 +187,7 @@ pub struct Response<T> {
/// The HTTP response head consists of a status, version, and a set of
/// header fields.
#[derive(Clone)]
#[non_exhaustive]
pub struct Parts {
/// The response's status
pub status: StatusCode,
Expand All @@ -199,8 +200,6 @@ pub struct Parts {

/// The response's extensions
pub extensions: Extensions,

_priv: (),
}

/// An HTTP response builder
Expand Down Expand Up @@ -507,7 +506,6 @@ impl Parts {
version: Version::default(),
headers: HeaderMap::default(),
extensions: Extensions::default(),
_priv: (),
}
}
}
Expand All @@ -519,7 +517,6 @@ impl fmt::Debug for Parts {
.field("version", &self.version)
.field("headers", &self.headers)
// omits Extensions because not useful
// omits _priv because not useful
.finish()
}
}
Expand Down
5 changes: 1 addition & 4 deletions src/uri/mod.rs
Expand Up @@ -103,6 +103,7 @@ pub struct Uri {
///
/// This struct is used to provide to and retrieve from a URI.
#[derive(Debug, Default)]
#[non_exhaustive]
pub struct Parts {
/// The scheme component of a URI
pub scheme: Option<Scheme>,
Expand All @@ -112,9 +113,6 @@ pub struct Parts {

/// The origin-form component of a URI
pub path_and_query: Option<PathAndQuery>,

/// Allow extending in the future
_priv: (),
}

/// An error resulting from a failed attempt to construct a URI.
Expand Down Expand Up @@ -814,7 +812,6 @@ impl From<Uri> for Parts {
scheme,
authority,
path_and_query,
_priv: (),
}
}
}
Expand Down