This: https://github.com/alexcrichton/tokio-process repo is archived and directs me here saying it was integrated in tokio.
Does tokio still have this functionality?
@andreycizov Hi, it has gotten merged into tokio-net.
The documentation can now be found at tokio_net::process.
This is what you should put in your _Cargo.toml_:
[dependencies]
tokio-net = { version = "0.2.0-alpha.5", features = ["process"] }
As a relative noob to rust, it took me about 90 minutes of effort to find this fix. I think the best fix would involve improving the api doc gen toolchain (so not this repo). However, given the current doc toolchain's behavior, maybe the tokio doc strings can be improved to help people like me.
Here was my process:
Background:
twisted and some javascript promise-like stuff.rustup doc or cargo doc --open).tokio and want to learn it.tokio world, so I know to double check every example to figure out which era it's from.rust + tokio skillset.Process:
tokio repo's README near the top after the first section.S to search, and typed process, then clicked the only hit for tokio::net::process which links to https://docs.rs/tokio/0.2.0-alpha.6/tokio/net/process/index.htmltokio-0.2.0-alpha.6.tokio = 0.2.0-alpha.6 into my project's dependencies.cargo doc --open.process and it's nowhere to be found.tokio, directly depending on tokio_net, etc…alpha.6 rather than alpha.5) and now cargo doc --open let's me search for and find tokio_net::process.So how can users (especially noobs) discover that they need the process feature? I don't see that in any documentation. I understand that features are such a standard part of the toolchain that experienced rust devs can probably dig into source code or other resources to figure out which features exist. But what about noobs?
Two fixes:
a. Manually tweak the tokio_net::process API docs to explicitly say "This module is only available when the process feature is enabled. To enable that feature for your project, do …".
b. Improve the rust doc generation toolchain to automatically add solution a. whenever it can detect modules are feature-dependent.
Obviously, a. could be resolved within this repo and b. will require modifying other tools. I'm not yet sure which repos are best for approach b, but if anyone points me to them I'll go pester those devs. >;-)
Also, I realize open source docs are super hard, so the next available time for this project, I intend to submit a patch for solution a. myself.
Thanks for the report. We will address this before the final. I will try to write up a proposal in the next week or so.
For one, we should have tokio::process in the main crate. I think that is probably the biggest problem right now.
@ipetkov are you able to include a re-export?
Hm, that sounds like one lingering confusion I have: https://docs.rs/tokio/0.2.0-alpha.6/tokio/net/process/index.html documents tokio::net::process whereas my local docs refer to tokio_net::process. I don't understand the discrepency (yet). Relevant snippet:
[dependencies]
tokio = "0.2.0-alpha.6"
tokio-net = { version = "0.2.0-alpha.6", features = ["process"] }
Are both dependencies necessary?
Also a rust noob question: if my binary depends on A and A depends on B, can I use B::foo in my project, or _must_ I explicitly declare B as a dependency?
We should avoid re-exporting process and signal from tokio::net and just have tokio::{process, signal}.
We do need to go around and clean all this up.
@carllerche yes I can move the reexports under tokio::{signal, process} instead of tokio::net::{signal, process}. This might lead to some different confusion for those who see the exports available under the tokio_net crate, but I figure we'll have this dust settle before the official 0.2 release. Looking forward to your proposal!
Also a rust noob question: if my binary depends on
AandAdepends onB, can Iuse B::fooin my project, or _must_ I explicitly declareBas a dependency?
@nathan-at-least you must explicitly declare B as a dependency, which allows cargo to figure out what version fits both yours and A's requirements. If you are already depending on the tokio crate, you can enable it's process feature (which in turn will depend on tokio_net and turn on its process feature):
[dependencies]
tokio = { version = "=0.2.0-alpha.6", features = ["process"] }
@ipetkov is process enabled by default for tokio? Ideally it should be.
@carllerche it is now in #1643!
The reexports have landed in master
Can we close this then?
Wow, this has been an extremely productive and positive experience! Thanks for the quick response, work towards a resolution, and answering my basic questions. I'm motivated to keep contributing to tokio as I go. <3
@ipetkov your suggested Cargo.toml dependency now works for me and opens local docs with the usability I expect.
So my current understanding is that tokio::net is reexported by tokio out of tokio_net, but this also is an implementation detail that application developers needn't know, since tokio is designed to be the application's primary interface for all of tokio. Furthermore an upcoming release of tokio will expose tokio::process without involving the tokio::net namespace. Is all of that understanding correct?
@nathan-at-least
So my current understanding is that
tokio::netis reexported bytokioout oftokio_net, but this also is an implementation detail that application developers needn't know, sincetokiois designed to be the application's primary interface for all oftokio.
Yes, if you are an application author you should depend on tokio directly and turn on whatever non-default features you may need (we will be revisiting what features are on by default as we get closer to publishing 0.2 after the alphas settle). The other tokio-* crates are more geared towards library authors that can depend only on the features they need rather than pulling in all of tokio.
Furthermore an upcoming release of
tokiowill exposetokio::processwithout involving thetokio::netnamespace. Is all of that understanding correct?
Yes we've landed a change in master where the process and signal APIs are exported from tokio::{process, signal} (the definitions still live in the tokio_net crate, though we may be revisiting crate organization before finalizing the 0.2 release).
I'm not sure if these changes have landed in the latest alpha, but if they haven't, they will soon! (My recommendation is to depend directly on the tokio crate if you are writing an application. We will not be removing any API exports from it in the near future, and right now all the public process APIs are exported there)
I'm going to close this issue out as it looks like we've reached any immediate resolutions for now.
We will be revisiting any API exports/crate organization/documentation before the 0.2 release so we can track that progress separately.
If anyone has any other questions, feel free to reopen this or a new issue!
Soon, everything will just exist in tokio and we will be able to avoid this.
Most helpful comment
For one, we should have
tokio::processin the main crate. I think that is probably the biggest problem right now.