-
Notifications
You must be signed in to change notification settings - Fork 221
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 Socket::new_nonblocking #293
Conversation
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 appreciate your work. Seems good for me.
I'm not sure about this. I understand you wanting to reduce the code duplication, but where do we draw the line when it comes to constructors? We already have two variants: "new" and "raw", do we also want |
Maybe there's a more general way to do this where we define a flags type which has a nonblocking flag, then use that? |
We could add our own bit to |
This seems like a potential argument for a let sock = SocketBuilder::new()
.nonblocking(true)
.finish(domain, ty, protocol);
let raw = SocketBuilder::new()
.nonblocking(true)
.finish_raw(domain, ty, protocol); or similar? |
We already have that in the |
Closing in favor of the idea proposed in #293 (comment). |
Equivalent to:
I've seen code like this several times and thought it would be useful to have a constructor that does the same thing.