Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upContribute Doctests to Tokio #54
Comments
yoshuawuyts
added
docs
WG web
labels
Aug 29, 2018
This comment has been minimized.
This comment has been minimized.
Thomasdezeeuw
commented
Aug 29, 2018
|
Why is this not an issue in the tokio repo? |
This comment has been minimized.
This comment has been minimized.
|
@Thomasdezeeuw good question! I guess it's mostly because I was approaching it from a Net WG perspective, but you're right that it would also have worked as an issue on Tokio. I'm not sure which one works best, but open for arguments pro / con. |
This comment has been minimized.
This comment has been minimized.
carllerche
commented
Aug 30, 2018
|
@yoshuawuyts I added a doc test section to the contributing guide: https://github.com/tokio-rs/tokio/blob/master/CONTRIBUTING.md#documentation-tests |
This comment has been minimized.
This comment has been minimized.
|
@carllerche thanks so much; it looks great! |
yoshuawuyts
added
the
Help Wanted
label
Sep 12, 2018
mattgathu
added a commit
to mattgathu/tokio
that referenced
this issue
Nov 26, 2018
mattgathu
referenced this issue
Nov 26, 2018
Merged
tcp: add usage examples to TcpListener and TcpStream #775
tobz
added a commit
to tokio-rs/tokio
that referenced
this issue
Nov 28, 2018
mattgathu
added a commit
to mattgathu/tokio
that referenced
this issue
Dec 1, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
yoshuawuyts commentedAug 29, 2018
•
edited
Contribute Doctests to Tokio
Summary
We propose to improve Tokio's documentation by adding doctests for each public
method.
Motivation
Tokio is a highly important library in Rust's ecosystem. It provides async
counterparts for many of stdlib's methods. However, unlike stdlib not every
method has usage examples yet (also known as doctests).
We propose to make a coordinated effort to track down missing usage examples,
and make pull requests to add them. This will hopefully both help people get
involved with Tokio, as help people new to the project find their way on how to
the libraries.
Implementation
I ran a script to find all
pub fnnames intokio, and added them to theoverview at the end of this issue. To contribute a doctest:
tokio-rs/tokio.Example from current documentation
Script
Drawbacks
There seems to be some duplication in the APIs between
tokioandtokio-*modules. If both modules are going to be merged, perhaps we should prioritize
one implementation first.
Secondly Tokio doesn't support
futures@0.3.0yet, which means async/awaitsupport is in somewhat of a transitioning phase. This might be an argument to
hold off until tokio upgrades to
futures@0.3.0. But there doesn't seem to be aclear timeline yet for when such a transition might be done, and there seem to
be clear benefits to improve documentation today.
There are over 600 API methods in
tokio. That means there's probably quite afew examples to be written. Therefor helping out with reviewing doctest PRs
would be fantastic too!
Rationale and alternatives
The idea of doctests is that they exist in harmony with more tutorials and
examples. It does not replace any of the above, but instead makes the existing
Unresolved Questions
We should probably figure out which modules to prioritize to prevent duplicate
work.
cc/ @carllerche @seanmonstar Your input would be valued a lot!
Overview
Tokio
tokio-channel
tokio-codec
tokio-executor
tokio-current-thread
tokio-fs
tokio-io
tokio-reactor
tokio-tcp
tokio-threadpool
tokio-timer
tokio-tls
tokio-udp
tokio-uds
tokio-io
tokio-threadpool
tokio-timer
tokio-async-await
tokio-fs