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

Add QueryIter::peek #282

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Add QueryIter::peek #282

wants to merge 1 commit into from

Conversation

Ralith
Copy link
Owner

@Ralith Ralith commented Sep 12, 2022

No description provided.

pub fn peek(&mut self) -> Option<<Q::Fetch as Fetch<'_>>::Item> {
// Safety: returned lifetime borrows `self`, ensuring it can't overlap with a future call to
// `peek` or `next`
unsafe { self.iter.peek().map(|x| x.1) }
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why strip the entity ID here if it is returned by the Iterator impl? Isn't that something the caller could need and if not ignore?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Yeah, that should definitely be included.

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.

2 participants