Skip to content

Commit

Permalink
Auto merge of #118484 - blyxxyz:os-str-slice, r=BurntSushi
Browse files Browse the repository at this point in the history
Add substring API for `OsStr`

This adds a method for taking a substring of an `OsStr`, which in combination with [`OsStr::as_encoded_bytes()`](https://doc.rust-lang.org/std/ffi/struct.OsStr.html#method.as_encoded_bytes) makes it possible to implement most string operations in safe code.

API:
```rust
impl OsStr {
    pub fn slice_encoded_bytes<R: ops::RangeBounds<usize>>(&self, range: R) -> &Self;
}
```
Motivation, examples and research at rust-lang/libs-team#306.

Tracking issue: #118485

cc `@epage`
r? libs-api
  • Loading branch information
bors committed Dec 2, 2023
2 parents 402dc7c + aaaa6c9 commit 8799af9
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit 8799af9

Please sign in to comment.