-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
StrSlice should have split_at #18063
Comments
It would have to make sure not to split the string across a multi-byte codepoint. |
In the context of Rust strings |
That would make it inconsistent with the other methods on "str", which use byte indices unless explicitly specified otherwise by the presence of "chars" in the method name. It would also introduce a hidden complexity cost, making the string version of "split_at" be O(n) instead of O(1) - the obvious use-case of splitting a string at multiple places then becomes O(n^2), which is unnacceptable for many applications. |
|
I'll take a look into this, if no one else is already. |
Sounds good. @gankro does this need an RfC? |
Uh, what are the traits called now? |
That was going to be my next question, I think StrSlice is no longer a trait as of 1.0alpha |
Does this still need to be done (i.e. has the trait been renamed), or should this be closed? |
(that trait no longer exists, and this is an inherent impl now) |
.split_at() on |
oh whoops! slice != str slice... |
ImmutableSlice
has asplit_at
method. This would probably be useful forStrSlice
as well.(It might be a good idea to share some of the other methods between
StrSlice
andImmutableSlice
too)The text was updated successfully, but these errors were encountered: