Skip to content

DSTify Str + impl Str for &S where S: Str #19248

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

Merged
merged 1 commit into from
Nov 24, 2014
Merged

Conversation

japaric
Copy link
Member

@japaric japaric commented Nov 23, 2014

Just like we do with AsSlice

This comes in handy when dealing with iterator-centric APIs (IntoIterator!) and you want to receive an Iterator<S> where S: Str argument. Without this PR, e.g. you can't receive &["a", "b"].iter() instead you'll have to type &["a", "b"].iter().map(|&x| x) (A similar thing happens with &[String]).

r? @aturon

Full disclaimer: I haven't run make/make check yet (All my cores are busy)

@aturon
Copy link
Member

aturon commented Nov 23, 2014

Thanks @japaric! It's not clear yet what the ultimate fate of these as_slice traits will be, but this is a fine improvement for now.

bors added a commit that referenced this pull request Nov 24, 2014
Just like we do with AsSlice

This comes in handy when dealing with iterator-centric APIs (`IntoIterator`!) and you want to receive an `Iterator<S> where S: Str` argument. Without this PR, e.g. you can't receive `&["a", "b"].iter()` instead you'll have to type `&["a", "b"].iter().map(|&x| x)` (A similar thing happens with `&[String]`).

r? @aturon 

Full disclaimer: I haven't run `make`/`make check` yet (All my cores are busy)
@bors bors closed this Nov 24, 2014
@bors bors merged commit 02720a4 into rust-lang:master Nov 24, 2014
@japaric japaric deleted the str branch December 16, 2014 02:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants