rust-lang / rust-lang/rust

Tracking Issue for `os_str_split_at`

Open
#156,199 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-tracking-issue S-tracking-unimplemented T-libs
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Feature gate: #![feature(os_str_split_at)]

This is a tracking issue for OsStr::{split_at, split_at_checked}.

This allows splitting OsStr on a valid UTF-8 boundary cross-platform.

Public API
// std::ffi
impl OsStr {
    // Panic if `mid` is not a valid boundary
    pub const fn split_at(&self, mid: usize) -> (&OsStr, &OsStr);
    // Returns `None` if `mid` is not a valid boundary
    pub const fn split_at_checked(&self, mid: usize) -> Option<(&OsStr, &OsStr)>;
}
Steps / History

(Remember to update the S-tracking-* label when checking boxes.)

  • ACP: rust-lang/libs-team#780
  • Implementation: #...
  • Final comment period (FCP)^1
  • Stabilization PR
Unresolved Questions
  • On platforms where OsStr is just bytes (e.g. Unix), should it allow splitting at arbitrary indexes? However, this would mean that you could safely write non-portable code using OsStr.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the std::ffi::OsStr API and the proposed split_at and split_at_checked signatures under the os_str_split_at feature gate. Review the unresolved question about arbitrary byte-index splitting on Unix before determining the implementation scope. Done means the implementation is complete, the portability question is resolved, and the tracking checklist is updated.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.