-
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
Implement AsRef<[T]>
for std::slice::Iter
.
#35559
Conversation
2cecd9a
to
9581999
Compare
@@ -996,6 +997,13 @@ impl<'a, T> Clone for Iter<'a, T> { | |||
fn clone(&self) -> Iter<'a, T> { Iter { ptr: self.ptr, end: self.end, _marker: self._marker } } | |||
} | |||
|
|||
#[stable(feature = "rust1", since = "1.12.0")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you have to make up a new feature name for this, even if it's stable.
9581999
to
97ee61d
Compare
Thanks for the PR @frewsxcv! Could you also expand on the motivation for this as well? |
`AsRef` is designed for conversions that are "cheap" (as per the API docs). It is the case that retrieving the underlying data of `std::slice::Iter` is cheap. In my opinion, there's no ambiguity about what slice data will be returned, otherwise, I would be more cautious about implementing `AsRef`.
97ee61d
to
dc22186
Compare
Updated. |
Thanks! This libs team discussed this PR during triage yesterday and the decision was to merge. @bors: r+ |
📌 Commit dc22186 has been approved by |
⌛ Testing commit dc22186 with merge 9376da6... |
Implement `AsRef<[T]>` for `std::slice::Iter`. `AsRef` is designed for conversions that are "cheap" (as per the API docs). It is the case that retrieving the underlying data of `std::slice::Iter` is cheap. In my opinion, there's no ambiguity about what slice data will be returned, otherwise, I would be more cautious about implementing `AsRef`.
AsRef
is designed for conversions that are "cheap" (as perthe API docs). It is the case that retrieving the underlying
data of
std::slice::Iter
is cheap. In my opinion, there's noambiguity about what slice data will be returned, otherwise,
I would be more cautious about implementing
AsRef
.