Skip to content

Reexport crate::poll_timeout::PollTimeoutTryFromError; #2602

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

Merged
merged 1 commit into from
Feb 12, 2025

Conversation

pacak
Copy link
Contributor

@pacak pacak commented Feb 10, 2025

What does this PR do

impl TryFrom<i16> for PollTimeout uses a custom error (PollTimeoutTryFromError), but the error type is not public so handling this error is not really possible. All this PR does is making the type public.

Normally something complains when you try to use private type in a public interface, not sure why is it not happening here.

Checklist:

  • I have read CONTRIBUTING.md
  • I have written necessary tests and rustdoc comments
  • A change log has been added if this PR modifies nix's API

@SteveLauC
Copy link
Member

not sure why is it not happening here.

Yeah, werid

Thanks!

src/sys/epoll.rs Outdated
@@ -1,5 +1,6 @@
use crate::errno::Errno;
pub use crate::poll_timeout::PollTimeout as EpollTimeout;
pub use crate::poll_timeout::PollTimeoutTryFromError;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub use crate::poll_timeout::PollTimeoutTryFromError;
pub use crate::poll_timeout::PollTimeoutTryFromError as EpollTimeoutTryFromError;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could, but I think this would lead in even more confusion. Consider this page: https://docs.rs/nix/latest/nix/sys/epoll/struct.EpollTimeout.html

It mentions EpollTimeout 3 times, it mentions the original name (PollTimeout) 68 times.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(did it anyway, it's not that important)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It mentions EpollTimeout 3 times, it mentions the original name (PollTimeout) 68 times.

Didn't expect that 🤦‍♂️, hope cargo doc will respect alias one day...

@SteveLauC
Copy link
Member

Mind doing it to poll too?

pub use crate::poll_timeout::PollTimeout;

pub use crate::poll_timeout::PollTimeoutTryFromError;

@SteveLauC SteveLauC added this pull request to the merge queue Feb 12, 2025
Merged via the queue into nix-rust:master with commit 3499c51 Feb 12, 2025
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants