Skip to content

Commit

Permalink
impl default
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaminBrienen committed Sep 22, 2024
1 parent 5cb70dc commit 34478ce
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions platforms/windows/src/window_handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,36 +10,37 @@ pub struct WindowHandle(pub HWND);
unsafe impl Send for WindowHandle {}
unsafe impl Sync for WindowHandle {}

impl From<*mut c_void> for WindowHandle
{
impl From<*mut c_void> for WindowHandle {
fn from(value: *mut c_void) -> Self {
Self(HWND(value))
}
}

impl From<HWND> for WindowHandle
{
impl From<HWND> for WindowHandle {
fn from(value: HWND) -> Self {
Self(value)
}
}

impl From<WindowHandle> for *mut c_void
{
impl From<WindowHandle> for *mut c_void {
fn from(value: WindowHandle) -> Self {
value.0.0
value.0 .0
}
}

impl From<WindowHandle> for HWND
{
impl From<WindowHandle> for HWND {
fn from(value: WindowHandle) -> Self {
value.0
}
}

mod tests
{
impl Default for WindowHandle {
fn default() -> Self {
Self(Default::default())
}
}

mod tests {
use super::*;

static_assertions::assert_impl_all!(WindowHandle: Send, Sync);
Expand Down

0 comments on commit 34478ce

Please sign in to comment.