-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Tracking Issue for str::as_str()
#130366
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
Comments
i don't think this is the correct API from the PR |
No, but this is what it will presumably get changed to: #129550 (comment) |
While this method is unstable, it might trip people up. If this causes a compilation error:
The solution is to change |
I am firmly against recommending to use
To combat this limitation, some concrete impls were added, such as Which means that now we cannot even add I guess there already is quite a lot of code out there that will break in the face of |
Worth noting that this is relevant if you want to use the stdlib to efficiently handle environment variables. I like to use the pattern:
However the one downside of this pattern is that some libraries will only define |
Feature gate:
#![feature(str_as_str)]
This is a tracking issue for the
as_str()
method on thestr
type itself, so thatBox<str>
,Rc<str>
,Arc<str>
& others can have the same things asString
has.Public API
Steps / History
Unresolved Questions
Footnotes
https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html ↩
The text was updated successfully, but these errors were encountered: