Skip to content
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

tokio::signal::unix::Signal and the Stream trait #5430

Closed
andrewbaxter opened this issue Feb 6, 2023 · 5 comments
Closed

tokio::signal::unix::Signal and the Stream trait #5430

andrewbaxter opened this issue Feb 6, 2023 · 5 comments
Labels
A-tokio Area: The main tokio crate A-tokio-stream Area: The tokio-stream crate C-bug Category: This is a bug. E-easy Call for participation: Experience needed to fix: Easy / not much E-help-wanted Call for participation: Help is requested to fix this issue. M-signal Module: tokio/signal M-stream Module: tokio/stream T-docs Topic: documentation

Comments

@andrewbaxter
Copy link

Was there a regression of #1848 ?

https://docs.rs/tokio/latest/tokio/signal/unix/struct.Signal.html (1.25.0) repeatedly refers to it as a stream but there's no stream implementation which confused me for a great while.

@andrewbaxter andrewbaxter added A-tokio Area: The main tokio crate C-bug Category: This is a bug. labels Feb 6, 2023
@brodybits
Copy link
Contributor

Was there a regression of #1848 ?

It looks to me like this was added in PR #1849 but with no tests and removed in 8efa620 (PR #3277).

@Darksonn Darksonn added T-docs Topic: documentation M-signal Module: tokio/signal M-stream Module: tokio/stream A-tokio-stream Area: The tokio-stream crate labels Feb 6, 2023
@Darksonn Darksonn changed the title tokio::signal::unix::Signal missing Stream impl tokio::signal::unix::Signal and the Stream trait Feb 6, 2023
@Darksonn
Copy link
Contributor

Darksonn commented Feb 6, 2023

Thank you for pointing this out. The documentation should include a link to tokio_stream::wrappers::SignalStream so that people can more easily discover how to get a Stream out of it. (It is intentional that it does not implement Stream anymore.)

I'm marking this as help-wanted. To fix this issue, please submit a PR that updates the documentation to include such a link. (See the docs for other stream-like types for an example way to phrase this.) If it is missing on the windows variants of Signal, then it should also be added there.

@Darksonn Darksonn added E-help-wanted Call for participation: Help is requested to fix this issue. E-easy Call for participation: Experience needed to fix: Easy / not much labels Feb 6, 2023
@brodybits
Copy link
Contributor

brodybits commented Feb 6, 2023

Correct, and I have noticed a few more things:

  • There seems to be a lack of tests & documentation for tokio_stream::wrappers::SignalStream. I was able to comment out all impl blocks from tokio-stream/src/wrappers/signal_unix.rs without triggering any test failures.
  • The documentation for Signal "repeatedly refers to it as a stream" (emphasis is mine), and I think it should be reworked.

Unfortunately I am not super-familiar with this functionality yet and am still pretty new to Rust, so I cannot promise too much meaningful progress anytime soon.

I would probably recommend updating the title (again) and removing the "E-easy" label to improve this situation.


P.S. I think the same test & documentation updates are needed for Windows as well.

@Darksonn
Copy link
Contributor

Darksonn commented Feb 6, 2023

The reason that no tests were added to the SignalStream wrapper is that it is a completely trivial wrapper around Signal. (And also, tokio-stream isn't tested very thoroughly in general.) Regardless, I would like to keep this one focused on the documentation issues in the main Tokio crate. Feel free to open a different issue about tests for the wrapper.

@amab8901
Copy link
Contributor

is the issue solved now that there is a merged PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate A-tokio-stream Area: The tokio-stream crate C-bug Category: This is a bug. E-easy Call for participation: Experience needed to fix: Easy / not much E-help-wanted Call for participation: Help is requested to fix this issue. M-signal Module: tokio/signal M-stream Module: tokio/stream T-docs Topic: documentation
Projects
None yet
Development

No branches or pull requests

4 participants