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 PartialEq/Eq to many js-sys types #1444

Merged
merged 2 commits into from
Apr 12, 2019

Conversation

alexcrichton
Copy link
Contributor

This commit adds #[derive(PartialEq, Eq)] to many types throughout
js-sys. These types are basically all based on Object, which means
that Object.is can be used for PartialEq and the Eq requirements
are upheld.

The macro has also been updated to internally store the deref target
instead of unconditionally storing JsValue, allowing #[derive] to
work a bit better in these situations.

Copy link
Contributor

@Pauan Pauan left a comment

Choose a reason for hiding this comment

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

Looks good!

@@ -2098,6 +2099,14 @@ impl Object {
}
}

impl PartialEq for Object {
fn eq(&self, other: &Object) -> bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should probably be #[inline]

This commit adds `#[derive(PartialEq, Eq)]` to many types throughout
`js-sys`. These types are basically all based on `Object`, which means
that `Object.is` can be used for `PartialEq` and the `Eq` requirements
are upheld.

The macro has also been updated to internally store the deref target
instead of unconditionally storing `JsValue`, allowing `#[derive]` to
work a bit better in these situations.
@alexcrichton alexcrichton merged commit 4211fcd into rustwasm:master Apr 12, 2019
@alexcrichton alexcrichton deleted the partial-eq branch April 12, 2019 16:03
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