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

Implement PartialEq for Cursor #67226

Closed
Luro02 opened this issue Dec 11, 2019 · 2 comments · Fixed by #67233
Closed

Implement PartialEq for Cursor #67226

Luro02 opened this issue Dec 11, 2019 · 2 comments · Fixed by #67233
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@Luro02
Copy link
Contributor

Luro02 commented Dec 11, 2019

I am thinking about something like this

impl<T: PartialEq> PartialEq for Cursor<T> {
    fn eq(&self, other: &Self) -> bool { self.get_ref() == other.get_ref() && self.position() == other.position() }
}

is there a reason why this is not implemented?

@jonas-schievink
Copy link
Contributor

This implementation would mean that two Cursors pointing at different positions of the same data would compare equal (can be fixed by also comparing position, of course).

@jonas-schievink jonas-schievink added C-feature-request Category: A feature request, i.e: not implemented / a PR. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Dec 11, 2019
@Luro02
Copy link
Contributor Author

Luro02 commented Dec 11, 2019

I updated the implementation

Centril added a commit to Centril/rust that referenced this issue Dec 23, 2019
Centril added a commit to Centril/rust that referenced this issue Dec 23, 2019
@bors bors closed this as completed in 260514d Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants