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
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 the OsStrExt 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?
Feature gate:
#![feature(os_str_slice)]This is a tracking issue for an API for taking substrings of
OsStr, which in combination withOsStr::as_encoded_bytes()would make it possible to implement most string operations in (portable) safe code.Public API
Steps / History
OsStrlibs-team#306OsStr#118484, MoveOsStr::slice_encoded_bytesvalidation to platform modules #118569Unresolved Questions
OsStris already fully specified to be arbitrary bytes by means of theOsStrExttrait. Should we:Footnotes
https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html ↩