rust-lang / rust-lang/rust

Tracking Issue for `str::as_str()` & friends

Open
#130,366 10 comments 34 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-tracking-issue T-libs
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Feature gate: #![feature(str_as_str)]

This is a tracking issue for the as_str() method on the str type itself, so that Box<str>, Rc<str>, Arc<str> & others can have the same things as String has.

Later also expanded to some other types (see below).

Public API
impl str {
    pub const fn as_str(&self) -> &str;
}
impl CStr {
    pub const fn as_c_str(&self) -> &CStr;
}
impl OsStr {
    pub const fn as_os_str(&self) -> &OsStr;
}
impl Path {
    pub const fn as_path(&self) -> &Path;
}
impl [T] {
    pub const fn as_slice(&self) -> &[T];
    pub const fn as_mut_slice(&mut self) -> &mut [T];
}
impl ByteStr {
    pub const fn as_byte_str(&self) -> &ByteStr;
    pub const fn as_mut_byte_str(&mut self) -> &mut ByteStr;
}
  • Tracking issue for ByteStr: #134915
Steps / History
Unresolved Questions
  • None yet.

Contributor guide

Open the contributing guide

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 with the public API and Steps / History sections, then read stabilization PR #151603 and the post-stabilization regression and revert issues #152961 and #152963. The work is done when the stabilization outcome is resolved and the remaining checklist accurately reflects it.

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.