-
Notifications
You must be signed in to change notification settings - Fork 666
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
Epoll type #1882
Epoll type #1882
Conversation
4613b6e
to
a19da40
Compare
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.
This looks like a good improvement. But I think you should deprecate the old interface. We don't want to provide two APIs for doing the same thing. Also, it needs a CHANGELOG entry.
/// # use nix::unistd::write; | ||
/// # use std::os::unix::io::{OwnedFd, FromRawFd, AsRawFd, AsFd}; | ||
/// # use std::time::{Instant, Duration}; | ||
/// # fn main() -> nix::Result<()> { |
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.
Do you need to declare the main()
function explicitly? If you leave it out, I think rustdoc will add it automatically.
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.
Rustdoc automatically adds main() {}
without a return type. To use ?
requires manually writing it with a return type.
a19da40
to
2b79c9b
Compare
Is there a policy on deprecation possibly using |
2b79c9b
to
4d6ef18
Compare
Yes, you need to |
671338e
to
7761c49
Compare
Added |
No. Due to the MSRV bump, release 0.26.0 won't include any of the I/O Safety stuff. So you should change it to 0.27.0. |
7761c49
to
791cca9
Compare
@asomers Updated it to |
791cca9
to
1c44507
Compare
src/sys/epoll.rs
Outdated
pub fn epoll_ctl<'a, T>( | ||
&self, | ||
op: EpollOp, | ||
fd: RawFd, |
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.
In the future, we should probably make this BorrowedFd, but not until that type has had time to trickle through the ecosystem.
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've updated it to be Fd
where Fd: AsFd
matching the other functions like Epoll::add
etc. I'm not sure about the case of specifically using BorrowedFd
as this prohibits someone simply passing a reference to an OwnedFd
and requires fd.as_fd()
rather than &fd
.
/// instance referred to by `self`. It requests that the operation `op` be performed for the | ||
/// target file descriptor, `fd`. | ||
/// | ||
/// When possible prefer [`Epoll::add`], [`Epoll::delete`] and [`Epoll::modify`]. |
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.
Is there any reason to make this public? Any operation that can't be performed with add
, delete
, or modify
?
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.
No, I'll make it private.
3d15481
to
b936348
Compare
856c166
to
2ece820
Compare
2ece820
to
4f61d12
Compare
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.
bors r+
Epoll can be most safely used as a type. This implement a type
Epoll
which supports this.