-
Notifications
You must be signed in to change notification settings - Fork 14k
Open
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
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: Tracking Issue for ByteStr/ByteString #134915
Steps / History
- Implementation:
- for
str: Add str.as_str() for easy Deref to string slices #129550- t-libs-api's approval: Add str.as_str() for easy Deref to string slices #129550 (comment)
- constify:
constify (the unstable)str::as_str#145930 - more types: Expand
str_as_strto more types #145933
- for
- Final comment period (FCP)1
- Stabilization PR
Unresolved Questions
- None yet.
Footnotes
Dushistov and futileWaffleLapkin, MolotovCherry, clubby789, lxl66566, grantfanian and 11 more
Metadata
Metadata
Assignees
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.