Skip to content

Commit 98d0886

Browse files
authoredJan 9, 2025··
feat(util): allow Empty constructor in const context (#129)
1 parent fed1452 commit 98d0886

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed
 

‎http-body-util/src/empty.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ pub struct Empty<D> {
1515

1616
impl<D> Empty<D> {
1717
/// Create a new `Empty`.
18-
pub fn new() -> Self {
19-
Self::default()
18+
pub const fn new() -> Self {
19+
Self {
20+
_marker: PhantomData,
21+
}
2022
}
2123
}
2224

@@ -49,9 +51,7 @@ impl<D> fmt::Debug for Empty<D> {
4951

5052
impl<D> Default for Empty<D> {
5153
fn default() -> Self {
52-
Self {
53-
_marker: PhantomData,
54-
}
54+
Self::new()
5555
}
5656
}
5757

0 commit comments

Comments
 (0)
Please sign in to comment.