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

Why the extra impl for ZipSlices? #67

Closed
SuperFluffy opened this issue Oct 7, 2015 · 3 comments
Closed

Why the extra impl for ZipSlices? #67

SuperFluffy opened this issue Oct 7, 2015 · 3 comments

Comments

@SuperFluffy
Copy link

I was looking at the ZipSlices impl and noticed that you have the signatures impl<'a, 'b, A, B> ZipSlices<&'a [A], &'b [B]> and impl<T, U> ZipSlices<T, U> where T: Slice, U: Slice. The latter seems a lot more general, and I was wondering why the former is still in the library? Are there some non-trivial reasons for this?

@SuperFluffy SuperFluffy changed the title Redundant impl for ZipSlices? Why the extra impl for ZipSlices? Oct 7, 2015
@bluss
Copy link
Member

bluss commented Oct 7, 2015

Yes, the reason is that the non-general one will force coercions, so it will actually work with arguments like &Vec<T>, so it's easier to use. Only problem is I've basically inverted the names for the two methods..

@bluss
Copy link
Member

bluss commented Oct 7, 2015

If type parameter defaults change the story for coercions, we can talk about removing it, until then it's useful.

@bluss
Copy link
Member

bluss commented Oct 7, 2015

Type param defaults: rust-lang/rust/issues/27336

@bluss bluss closed this as completed Oct 7, 2015
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

No branches or pull requests

2 participants