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 common Std traits on many types #3796

Merged
merged 1 commit into from
Aug 7, 2024

Conversation

daxpedda
Copy link
Member

Notable implementations:

  • DeviceId: Default, uses DeviceId::dumy().
  • ActiveEventLoop, EventLoop, EventLoopProxy: refrained from implementing anymore then Debug because they should be unique.
  • EventLoopBuilder: Eq, Hash and PartialEq.
  • InnerSizeWriter: refrained from implementing Hash.
  • OwnedDisplayHandle: Eq and PartialEq.
  • KeyLocation, ModifiersKeyState: Ord and PartialOrd.
  • AnyThread: Clone.
  • Window: Eq, Hash and PartialEq via WindowId.

Replaced Debug implementations using f.pad("Type { .. }") with f.debug_struct("Type").finish_non_exhaustive().

Let me know if anything is too contentious and I can remove it.

Follows C-COMMON-TRAITS.

@daxpedda daxpedda added the S - enhancement Wouldn't this be the coolest? label Jul 17, 2024
@daxpedda daxpedda force-pushed the more-derive branch 3 times, most recently from b60f794 to 7b5c899 Compare July 20, 2024 18:34
Copy link
Member

@notgull notgull left a comment

Choose a reason for hiding this comment

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

Looks mostly fine to me

@@ -486,7 +492,7 @@ unsafe impl rwh_05::HasRawDisplayHandle for ActiveEventLoop {
///
/// - A zero-sized type that is likely optimized out.
/// - A reference-counted pointer to the underlying type.
#[derive(Clone)]
#[derive(Clone, PartialEq, Eq)]
Copy link
Member

Choose a reason for hiding this comment

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

What's the user story for this one?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ha!
I would honestly not be able to come up with one.

Happy to remove it if you don't like it!

@daxpedda daxpedda merged commit 1168cd4 into rust-windowing:master Aug 7, 2024
54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S - enhancement Wouldn't this be the coolest?
Development

Successfully merging this pull request may close these issues.

3 participants