Open
Description
Feature gate: #![feature(os_str_slice)]
This is a tracking issue for an API for taking substrings of OsStr
, which in combination with OsStr::as_encoded_bytes()
would make it possible to implement most string operations in (portable) safe code.
Public API
impl OsStr {
pub fn slice_encoded_bytes<R: ops::RangeBounds<usize>>(&self, range: R) -> &Self;
}
Steps / History
- ACP: ACP: A substring API for
OsStr
libs-team#306 - Implementation: Add substring API for
OsStr
#118484, MoveOsStr::slice_encoded_bytes
validation to platform modules #118569 - Final comment period (FCP)1
- Stabilization PR
Unresolved Questions
- Currently this enforces the same requirements on all platforms, but on Unix (and some other platforms) the internal encoding of
OsStr
is already fully specified to be arbitrary bytes by means of theOsStrExt
trait. Should we:- Relax the requirements on these platforms,
- Keep enforcing the lowest common denominator invariants, or
- Use strict checks now, but leave the possibility of relaxing them later?