Implement common Std traits on many types (#3796)
This commit is contained in:
parent
9dff801f93
commit
1168cd4113
28 changed files with 167 additions and 103 deletions
|
|
@ -143,6 +143,28 @@ impl Default for PlatformSpecificEventLoopAttributes {
|
|||
}
|
||||
}
|
||||
|
||||
impl PartialEq for PlatformSpecificEventLoopAttributes {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.any_thread.eq(&other.any_thread)
|
||||
&& self.dpi_aware.eq(&other.dpi_aware)
|
||||
&& match (&self.msg_hook, &other.msg_hook) {
|
||||
(Some(this), Some(other)) => std::ptr::eq(&this, &other),
|
||||
(None, None) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Eq for PlatformSpecificEventLoopAttributes {}
|
||||
|
||||
impl std::hash::Hash for PlatformSpecificEventLoopAttributes {
|
||||
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||
self.any_thread.hash(state);
|
||||
self.dpi_aware.hash(state);
|
||||
std::ptr::hash(&self.msg_hook, state);
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ActiveEventLoop {
|
||||
thread_id: u32,
|
||||
thread_msg_target: HWND,
|
||||
|
|
@ -565,7 +587,7 @@ impl rwh_06::HasDisplayHandle for ActiveEventLoop {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, PartialEq, Eq)]
|
||||
pub(crate) struct OwnedDisplayHandle;
|
||||
|
||||
impl OwnedDisplayHandle {
|
||||
|
|
|
|||
|
|
@ -63,12 +63,12 @@ pub enum IconType {
|
|||
Big = ICON_BIG as isize,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, PartialEq, Eq, Hash)]
|
||||
struct RaiiIcon {
|
||||
handle: HICON,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, PartialEq, Eq, Hash)]
|
||||
pub struct WinIcon {
|
||||
inner: Arc<RaiiIcon>,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ use crate::keyboard::Key;
|
|||
use crate::platform::windows::{BackdropType, Color, CornerPreference};
|
||||
use crate::platform_impl::Fullscreen;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct PlatformSpecificWindowAttributes {
|
||||
pub owner: Option<HWND>,
|
||||
pub menu: Option<HMENU>,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue