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

Update pattern docs. #71334

Merged
merged 1 commit into from
Apr 20, 2020
Merged

Update pattern docs. #71334

merged 1 commit into from
Apr 20, 2020

Conversation

ehuss
Copy link
Contributor

@ehuss ehuss commented Apr 19, 2020

A few changes to help clarify string pattern usage:

When Pattern is stabilized, the phrasing in the str methods can be updated to be more general to reflect the exact behavior. I'm reluctant to do this now because the stability story for Pattern is uncertain. It may perhaps look something like:

The pattern can be any type that implements the [Pattern] trait. Notable examples are &str, [char], arrays of [char], or functions or closures that determines if a character matches. Additional libraries might provide more complex patterns like regular expressions.

This is complicated because methods like trim_matches have bounds, which for example don't support str, so those methods may need more elaboration.

@rust-highfive
Copy link
Collaborator

r? @kennytm

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 19, 2020
@kennytm
Copy link
Member

kennytm commented Apr 19, 2020

@bors r+

@bors
Copy link
Contributor

bors commented Apr 19, 2020

📌 Commit 34f0a608c8581280e4d11e96168878b54da537da has been approved by kennytm

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 19, 2020
@ehuss
Copy link
Contributor Author

ehuss commented Apr 20, 2020

Hm, I just had a thought that it would be more correct to use the word "slice" instead of "array" for [char]. Would you agree?

@kennytm
Copy link
Member

kennytm commented Apr 20, 2020

It is fine

@ehuss
Copy link
Contributor Author

ehuss commented Apr 20, 2020

Thanks!
@bors r=kennytm rollup

@bors
Copy link
Contributor

bors commented Apr 20, 2020

📌 Commit ca61fd5 has been approved by kennytm

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Apr 20, 2020
Update pattern docs.

A few changes to help clarify string pattern usage:

* Add some examples and stability information in the `pattern` module.
* Fixes the links at https://doc.rust-lang.org/std/str/pattern/ because intra-doc-links don't work with re-exported modules (rust-lang#65983 I think?).
* Consistently use the same phrasing for `str` methods taking a pattern.
    * Also mention that array of `char` is also accepted.

When `Pattern` is stabilized, the phrasing in the `str` methods can be updated to be more general to reflect the exact behavior. I'm reluctant to do this now because the stability story for `Pattern` is uncertain. It may perhaps look something like:

> The pattern can be any type that implements the [`Pattern`] trait. Notable examples are `&str`, [`char`], arrays of [`char`], or functions or closures that determines if a character matches. Additional libraries might provide more complex patterns like regular expressions.

This is complicated because methods like `trim_matches` have bounds, which for example don't support `str`, so those methods may need more elaboration.
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Apr 20, 2020
Update pattern docs.

A few changes to help clarify string pattern usage:

* Add some examples and stability information in the `pattern` module.
* Fixes the links at https://doc.rust-lang.org/std/str/pattern/ because intra-doc-links don't work with re-exported modules (rust-lang#65983 I think?).
* Consistently use the same phrasing for `str` methods taking a pattern.
    * Also mention that array of `char` is also accepted.

When `Pattern` is stabilized, the phrasing in the `str` methods can be updated to be more general to reflect the exact behavior. I'm reluctant to do this now because the stability story for `Pattern` is uncertain. It may perhaps look something like:

> The pattern can be any type that implements the [`Pattern`] trait. Notable examples are `&str`, [`char`], arrays of [`char`], or functions or closures that determines if a character matches. Additional libraries might provide more complex patterns like regular expressions.

This is complicated because methods like `trim_matches` have bounds, which for example don't support `str`, so those methods may need more elaboration.
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Apr 20, 2020
Update pattern docs.

A few changes to help clarify string pattern usage:

* Add some examples and stability information in the `pattern` module.
* Fixes the links at https://doc.rust-lang.org/std/str/pattern/ because intra-doc-links don't work with re-exported modules (rust-lang#65983 I think?).
* Consistently use the same phrasing for `str` methods taking a pattern.
    * Also mention that array of `char` is also accepted.

When `Pattern` is stabilized, the phrasing in the `str` methods can be updated to be more general to reflect the exact behavior. I'm reluctant to do this now because the stability story for `Pattern` is uncertain. It may perhaps look something like:

> The pattern can be any type that implements the [`Pattern`] trait. Notable examples are `&str`, [`char`], arrays of [`char`], or functions or closures that determines if a character matches. Additional libraries might provide more complex patterns like regular expressions.

This is complicated because methods like `trim_matches` have bounds, which for example don't support `str`, so those methods may need more elaboration.
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 20, 2020
Rollup of 5 pull requests

Successful merges:

 - rust-lang#71250 (Replace big JS dict with JSON parsing)
 - rust-lang#71270 (Fix `has_no_input_arg` check and rename it to `has_only_self_parameter`)
 - rust-lang#71284 (fix -Zast-json to output correct JSON form)
 - rust-lang#71328 (Stabilize PathBuf capacity methods)
 - rust-lang#71334 (Update pattern docs.)

Failed merges:

r? @ghost
@bors bors merged commit b921587 into rust-lang:master Apr 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants