-
Notifications
You must be signed in to change notification settings - Fork 63
Add Empty
#37
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
Add Empty
#37
Conversation
pub fn new() -> Self { | ||
Self::default() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Structs of this kind are usually created by a freestanding function rather than an associated function (cf. std::future::pending
and futures_util::stream::empty
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm open to that but its not my personal preference. I would like to hear what someone else thinks.
Possibly related: hyperium/hyper#2345. |
Co-authored-by: Daiki Mizukami <[email protected]>
Co-authored-by: Daiki Mizukami <[email protected]>
Empty
is a little utility type that I have found useful in a fewscenarios. For example to make a "catch all"
tower::Service
thatalways returns
404 Not Found
with an empty body.