Confusing documentation around `Arc<[u8]>` compatibility

Open Beginner friendly
#685 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Documentation
Clarity
Mostly clear
Activity status
Active
Tech stack
rust
Domain
documentation

Research direction

Start with the Bytes documentation's sharing section at the linked docs.rs page and compare its Arc<[u8]> statement with the conversions the crate actually provides. Update the wording so it describes supported behavior without implying a nonexistent conversion, then verify the rendered documentation is accurate.

Written by the indexing model from the issue text.

Description

The latest documentation of the crate reads:

For Bytes implementations which point to a reference counted shared storage (e.g. an Arc<[u8]>),
sharing will be implemented by increasing the reference count.

Reference: https://docs.rs/bytes/latest/bytes/struct.Bytes.html#sharing

This lead me to assume that Bytes should provide a from conversion function from an Arc<[u8]> to a Bytes instance where the backing storage is an Arc. However, it doesn't appear that this from function exists.

I don't think it's a good idea for documentation to reference imaginary scenarios that aren't implemented by the library as it sets up false expectations with regard to how the library works and what features it provides.

Dominant language
Rust
Stars
2.3k
Forks
355
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from tokio-rs/bytes

All issues in tokio-rs/bytes

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.