-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
RFC: Change return type of str::replace to MaybeOwned to avoid a copy #33
Conversation
I am slightly worried about the usage of this This may not be the last method to receive the |
@alexcrichton I'm tentatively in favor of using This would be somewhat alleviated if |
We can have iterators too, so there's very very rarely an allocation (e.g. |
MaybeOwned could implement Also, I don't think this deserves an RFC. RFCs should be for language changes and changes to items marked |
Filed #35 about this. |
I like this idea. Can’t wait for DST :) |
I do think this deserves an RFC, in the sense that it represents a broader API decision. Also, while str and vec are not technically stable, they are probably as close as anything we have (though we can expect some post-DST mixup in the traits and so forth). |
Discussed at https://github.com/mozilla/rust/wiki/Meeting-weekly-2014-06-10 There's not a lot of love for |
@aturon Is it worth reviving this RFC, with s/MaybeOwned/CowString/ ? |
This is definitely worth revisiting, now that our clone-on-write plans are clear. In particular, we need a clear convention for when |
An interesting note: it's generally possible to go from taking owned/borrowed strings as inputs and accepting |
For what it’s worth, there is a precedent of returning |
I agree with @aturon that we should probably have a strong set of conventions for returning |
No description provided.