Skip to content

Commit 61eaea9

Browse files
committed
refactor(lib): use non_exhaustive macro for future field expanding instead of manual implementation
1 parent 63102bc commit 61eaea9

File tree

3 files changed

+3
-11
lines changed

3 files changed

+3
-11
lines changed

src/request.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ pub struct Request<T> {
165165
/// The HTTP request head consists of a method, uri, version, and a set of
166166
/// header fields.
167167
#[derive(Clone)]
168+
#[non_exhaustive]
168169
pub struct Parts {
169170
/// The request's method
170171
pub method: Method,
@@ -180,8 +181,6 @@ pub struct Parts {
180181

181182
/// The request's extensions
182183
pub extensions: Extensions,
183-
184-
_priv: (),
185184
}
186185

187186
/// An HTTP request builder
@@ -715,7 +714,6 @@ impl Parts {
715714
version: Version::default(),
716715
headers: HeaderMap::default(),
717716
extensions: Extensions::default(),
718-
_priv: (),
719717
}
720718
}
721719
}

src/response.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ pub struct Response<T> {
187187
/// The HTTP response head consists of a status, version, and a set of
188188
/// header fields.
189189
#[derive(Clone)]
190+
#[non_exhaustive]
190191
pub struct Parts {
191192
/// The response's status
192193
pub status: StatusCode,
@@ -199,8 +200,6 @@ pub struct Parts {
199200

200201
/// The response's extensions
201202
pub extensions: Extensions,
202-
203-
_priv: (),
204203
}
205204

206205
/// An HTTP response builder
@@ -507,7 +506,6 @@ impl Parts {
507506
version: Version::default(),
508507
headers: HeaderMap::default(),
509508
extensions: Extensions::default(),
510-
_priv: (),
511509
}
512510
}
513511
}
@@ -519,7 +517,6 @@ impl fmt::Debug for Parts {
519517
.field("version", &self.version)
520518
.field("headers", &self.headers)
521519
// omits Extensions because not useful
522-
// omits _priv because not useful
523520
.finish()
524521
}
525522
}

src/uri/mod.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ pub struct Uri {
103103
///
104104
/// This struct is used to provide to and retrieve from a URI.
105105
#[derive(Debug, Default)]
106+
#[non_exhaustive]
106107
pub struct Parts {
107108
/// The scheme component of a URI
108109
pub scheme: Option<Scheme>,
@@ -112,9 +113,6 @@ pub struct Parts {
112113

113114
/// The origin-form component of a URI
114115
pub path_and_query: Option<PathAndQuery>,
115-
116-
/// Allow extending in the future
117-
_priv: (),
118116
}
119117

120118
/// An error resulting from a failed attempt to construct a URI.
@@ -814,7 +812,6 @@ impl From<Uri> for Parts {
814812
scheme,
815813
authority,
816814
path_and_query,
817-
_priv: (),
818815
}
819816
}
820817
}

0 commit comments

Comments
 (0)