Skip to content

Conversation

@knight42
Copy link

@knight42 knight42 commented Sep 8, 2016

Replaces first N matches of a pattern with another string.

assert_eq!("acaaa".replacen(a, "b", 3), "bcbba")

@knight42
Copy link
Author

knight42 commented Sep 8, 2016

It's rare that @rust-highfive didn't show up 😮

Copy link
Member

@nagisa nagisa Sep 8, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Insta-stable? AFAICT there’s no tracking issue which went through FCP for stabilisation?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nagisa I'm sorry... Should I submit a RFC about this? BTW, where can I know the process of accepting a new method?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An unstable method with a corresponding tracking issue may be enough.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nagisa Am I supposed to open the tracking issue by myself?

Copy link
Member

@nagisa nagisa Sep 8, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’d suggest to only do that after you get thumbs-up from the libs team for the feature you’re adding. In the mean-time you can use 0 as a placeholder issue for the attribute.

@nagisa
Copy link
Member

nagisa commented Sep 8, 2016

This PR needs a reviewer, @rust-lang/libs.

@knight42
Copy link
Author

knight42 commented Sep 8, 2016

@nagisa Thanks for your advice! 😄

@WiSaGaN
Copy link
Contributor

WiSaGaN commented Sep 8, 2016

Seems quite niche to me.

Copy link
Contributor

@bluss bluss Sep 8, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using .take(count) would be the more typical way to limit the number of iterations here. (I'd understand it right away :D)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point!

@alexcrichton alexcrichton added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Sep 8, 2016
@alexcrichton
Copy link
Member

Discussed at libs triage today the decision was to merge. @knight42 could you open an issue on rust-lang/rust to track the stabilization of this and update the #[unstable] tag reference? I'll be sure to tag it correctly once it's opened.

@knight42
Copy link
Author

@alexcrichton Great to hear that! 🎉

The #[unstable] tag has been updated now.

@alexcrichton
Copy link
Member

@bors: r+

Thanks!

@bors
Copy link
Collaborator

bors commented Sep 13, 2016

📌 Commit ebda770 has been approved by alexcrichton

@bors
Copy link
Collaborator

bors commented Sep 14, 2016

⌛ Testing commit ebda770 with merge e25e32c...

@bors
Copy link
Collaborator

bors commented Sep 14, 2016

💔 Test failed - auto-win-msvc-64-opt-rustbuild

@knight42
Copy link
Author

@alexcrichton the failure seems spurious

@alexcrichton
Copy link
Member

@bors: retry

On Tue, Sep 13, 2016 at 8:59 PM, Jian Zeng [email protected] wrote:

@alexcrichton https://github.com/alexcrichton the failure seems
spurious


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#36347 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAD95MD5gYcTCvYvO5_d1JvbEp2EOplhks5qp3EegaJpZM4J33bo
.

@bors
Copy link
Collaborator

bors commented Sep 15, 2016

⌛ Testing commit ebda770 with merge 16ff9e2...

bors added a commit that referenced this pull request Sep 15, 2016
Implement std::str::replacen

Replaces first N matches of a pattern with another string.

```
assert_eq!("acaaa".replacen(a, "b", 3), "bcbba")
```
@bors bors merged commit ebda770 into rust-lang:master Sep 15, 2016
@knight42 knight42 deleted the str-replacen branch September 15, 2016 07:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants