rust-random / rust-random/rand

CHANGE: use std::ascii::Char

Open
#1,590 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

B-API P-postpone
Dominant language
Rust
Stars
2.1k
Forks
512
Avg merge
3d 9h
Merged PRs (30d)
7

Description

std has a new, unstable, type: std::ascii:Char. This should get a corresponding impl Extend<ascii::Char> for String.

Alphanumeric (and soon Alphabetic #1587) sample u8 ASCII values since these are smaller than char and may be used to extend a String more efficiently, albeit unsafely. Switching these to ascii::Char (once stable) should give us a fast, safe alternative.

To keep type inference, we should replace the existing implementations of Distribution for these types. This is a breaking change (but an additional impl would also be breaking).

Alternative

We could (once impl Extend<ascii::Char> for String is available) switch to ascii::Char before the type is stabilized.

Motivation: allow us to release Rust v1.0 without expecting to make a breaking change here later.

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 checking the existing Distribution implementations for Alphanumeric and Alphabetic, then verify the stabilization status and API of std::ascii::Char and String's Extend implementation. Done means the relevant distributions use ascii::Char while preserving type inference, with the breaking-change implications resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.