tokio-rs / tokio-rs/bytes

Expose UTF-8 validated string type

Open
#697 3 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

bytes has become a little bit of a de facto standard for low/zero-copy techniques, with authors of some popular crates being comfortable with exposing bytes types in their interfaces. In some cases, those crates would benefit from a bytes string wrapper to enable zero-copy string handling, but they don't support such handling because bytes doesn't and they don't want to include another crate like bytestring, which isn't a de facto standard as of now, in their interfaces.

For example, prost, which implements conversion between Rust types and protocol buffers, supports using Bytes instead of Vec<u8> to back protobuf bytes fields, but it doesn't a similar alternative for String, despite it being a requested feature (tokio-rs/prost#752), in part because bytes doesn't have a string wrapper type.

Would the bytes maintainers be open to exposing such a type, along the lines of the one described in #373, in order to better enable these use cases in the ecosystem?

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.

Research direction

Start by reading the design described in issue #373 and the requested prost integration in tokio-rs/prost#752. Determine the public API and validation requirements for an exposed UTF-8 string wrapper, then confirm that the resulting design supports zero-copy handling without introducing an unnecessary interface dependency.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.