Client documentation is too limited
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.3k
- Forks
- 1.8k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 14
Description
A few aspects of this were discussed in a users forum thread, but based on initial feedback in PRs #1565 and #1568, it seems a more clear problem statement is needed.
Problem Statement
The current examples/client.rs, its guide explanation, and the client module doctest use run and no other alternatives are shown. In order to use run, these utilize futures::future::lazy to move the client into a single request future. Outwardly this makes things look minimal, clean and friendly, but as a pattern this is a dead end for building an application beyond the most trivial, single request case:
-
The
Clientin this formulation can't be reused for more than the single request, in order to take advantage of important features like connection keep-alive. -
Methods
runas used, orblock_on, are inappropriate in the runtime context. Onlyspawnis non-blocking, but no current client example shows that usage. -
Its not obvious why
lazyis needed or what the shutdown requirements of the runtime and Client are. Omittinglazyor moving theClientoutside of the future can result in these examples halting (never shutting down.)
Code examples could be improved to some extent with comments. Going further, in #1565 I propose using block_on in the doctest, and in #1568: spawn and explicit shutdown in the examples/client.rs. Alternatively, instead of replacing the run + lazy examples, these could be adapted to include the alternatives along side.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with examples/client.rs and the client module doctest, then review the guide explanation and the feedback in PRs #1565 and #1568. Determine which client and runtime usage alternatives the documentation should present, including shutdown behavior. Done means the examples explain reuse, runtime calls, lazy, and shutdown clearly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100