rust-lang / rust-lang/libs-team

REQUEST: Implement fmt::LowerHex and fmt::UpperHex for Vec<u8> and [u8].

Open
#545 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
178
Forks
28
Avg merge
15m
Merged PRs (30d)
1

Description

Problem

Printing byte strings as hex is a very common thing to do. Currently we need to implement is manually or use a third-party crate like hex.

We have the hex traits in fmt though, currently only implemented on integer types. I figured we couldn't have them on Vec<u8> because maybe it was generically implemented on Vec<impl fmt::LowerHex>, but that's not the case.

Is there a reason this isn't done?

Proposed Solution

Implement fmt::LowerHex and fmt::UpperHex for Vec and [u8].

Notes

No response

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 locating the existing fmt::LowerHex and fmt::UpperHex implementations for integer types and the relevant Vec and [u8] entry points. Add coverage to the relevant formatting tests and verify that both byte-string types produce the expected lower- and uppercase hexadecimal output.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.