Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No way to portably find if OsStr has a particular prefix #22741

Closed
codyps opened this issue Feb 23, 2015 · 3 comments
Closed

No way to portably find if OsStr has a particular prefix #22741

codyps opened this issue Feb 23, 2015 · 3 comments

Comments

@codyps
Copy link
Contributor

codyps commented Feb 23, 2015

This is essentially the operation provided by starts_with() on String, str, and slice.

Right now, this can only be done by either:

  • requiring the OsStr to be utf-8 (and converting it to str/String)
  • Or depending on the unix-only as_bytes() method on OsStrExt
@alexcrichton
Copy link
Member

This is a fundamental limitation of OsString and how it represents two different encodings on Unix and Windows. It is certainly possible to add many more APIs over time to perform various operations on an OsStr such as looking for prefixes, splitting, etc.

Or depending on the unix-only as_bytes() method on OsStrExt

There is also an encode_wide function on Windows for performing this sort of operation.

This issue, however, boils down to requesting more functionality be added to OsStr (new APIs), and belongs in the RFC repo instead of the rust-lang/rust repo. Would you be ok opening an issue over there instead?

@codyps
Copy link
Contributor Author

codyps commented Feb 24, 2015

I'm not sure it's worth asking if I'm "ok" with it if that is the location I'm required to open a ticket. Next time just tell me what needs to happen.

@alexcrichton
Copy link
Member

Issues for new APIs and/or functionality in the standard library now belong in the RFC repository as they will require an RFC to be added.

Closing in favor of rust-lang/rfcs#900

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants