Tracking Issue for `str::as_str()` & friends
Open
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
- Implementation:
- for
str: #129550- t-libs-api's approval: https://github.com/rust-lang/rust/pull/129550#issuecomment-2326941244
- constify: #145930
- more types: #145933
- for
- Final comment period (FCP)^1: https://github.com/rust-lang/rust/pull/151603#issuecomment-3936115026
- Stabilizatoin
- Stabilization PR: #151603
- Post-stabilization regression: #152961
- Revert stabilization: #152963
Unresolved Questions
- None yet.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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