-
Notifications
You must be signed in to change notification settings - Fork 669
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
FdSet: allow conversion from iterable of AsFd #2383
base: master
Are you sure you want to change the base?
Conversation
I'm not sure what the better type is, but I think the iterator item type should be the same as the argument type ofFdSet::insert, so that the implementation would be just
instead of duplicating the unsafe implementation of insert. would that be ok: 7def327 ? Or would it be an API breaking change to also change insert? |
The goal here was definitely to avoid having to add a map in the user's construction code. What if we factored the unsafe code into another function that both insert and this could use? |
Line 41 in f129095
AsFd would allow passing an OwnedFd or File, which would be closed on drop, leaving the FdSet with closed fds. you can reproduce it if you change your test a bit
panics with |
The And for that
I am not sure I understand what this means,
would you like to elaborate on it a bit? |
we might document it :) |
appart from type issue, I like the idea of the PR: having a way to construct an |
Yeah, I think we can document it in the comments |
The goal was to avoid this snippet from the linked commit: I have not forgotten this PR, I am simply sidetracked onto other projects for a bit :) |
What does this PR do
Adds an implementation of
FromIterator
andFrom
forFdSet
, allowing them to be constructed from iterables of types that implementAsFd
.Checklist:
CONTRIBUTING.md