chore: use our own AsAny to provide &dyn Any
This removes the direct requirement to implement `as_any` and it could be just derived. Also implement HasDisplayHandle for dyn ActiveEventLoop + '_. Suggested-by: daxpedda <daxpedda@gmail.com>
This commit is contained in:
parent
038ef5c3ad
commit
3392e9c1de
10 changed files with 27 additions and 46 deletions
|
|
@ -1,4 +1,3 @@
|
|||
use std::any::Any;
|
||||
use std::cell::Cell;
|
||||
use std::hash::Hash;
|
||||
use std::num::{NonZeroU16, NonZeroU32};
|
||||
|
|
@ -640,10 +639,6 @@ impl RootActiveEventLoop for ActiveEventLoop {
|
|||
RootOwnedDisplayHandle { platform: OwnedDisplayHandle }
|
||||
}
|
||||
|
||||
fn as_any(&self) -> &dyn Any {
|
||||
self
|
||||
}
|
||||
|
||||
#[cfg(feature = "rwh_06")]
|
||||
fn rwh_06_handle(&self) -> &dyn rwh_06::HasDisplayHandle {
|
||||
self
|
||||
|
|
|
|||
|
|
@ -159,10 +159,6 @@ impl RootActiveEventLoop for ActiveEventLoop {
|
|||
RootOwnedDisplayHandle { platform: OwnedDisplayHandle }
|
||||
}
|
||||
|
||||
fn as_any(&self) -> &dyn Any {
|
||||
self
|
||||
}
|
||||
|
||||
#[cfg(feature = "rwh_06")]
|
||||
fn rwh_06_handle(&self) -> &dyn rwh_06::HasDisplayHandle {
|
||||
self
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
use std::any::Any;
|
||||
use std::ffi::{c_char, c_int, c_void};
|
||||
use std::ptr::{self, NonNull};
|
||||
use std::sync::atomic::{AtomicBool, Ordering as AtomicOrdering};
|
||||
|
|
@ -94,10 +93,6 @@ impl RootActiveEventLoop for ActiveEventLoop {
|
|||
RootOwnedDisplayHandle { platform: OwnedDisplayHandle }
|
||||
}
|
||||
|
||||
fn as_any(&self) -> &dyn Any {
|
||||
self
|
||||
}
|
||||
|
||||
#[cfg(feature = "rwh_06")]
|
||||
fn rwh_06_handle(&self) -> &dyn rwh_06::HasDisplayHandle {
|
||||
self
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
//! The event-loop routines.
|
||||
|
||||
use std::any::Any;
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::io::Result as IOResult;
|
||||
use std::mem;
|
||||
|
|
@ -658,11 +657,6 @@ impl RootActiveEventLoop for ActiveEventLoop {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn as_any(&self) -> &dyn Any {
|
||||
self
|
||||
}
|
||||
|
||||
#[cfg(feature = "rwh_06")]
|
||||
fn rwh_06_handle(&self) -> &dyn rwh_06::HasDisplayHandle {
|
||||
self
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
use std::any::Any;
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::collections::{HashMap, HashSet, VecDeque};
|
||||
use std::ffi::CStr;
|
||||
|
|
@ -751,10 +750,6 @@ impl RootActiveEventLoop for ActiveEventLoop {
|
|||
RootOwnedDisplayHandle { platform: handle }
|
||||
}
|
||||
|
||||
fn as_any(&self) -> &dyn Any {
|
||||
self
|
||||
}
|
||||
|
||||
#[cfg(feature = "rwh_06")]
|
||||
fn rwh_06_handle(&self) -> &dyn rwh_06::HasDisplayHandle {
|
||||
self
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
use std::any::Any;
|
||||
use std::cell::Cell;
|
||||
use std::collections::VecDeque;
|
||||
use std::sync::{mpsc, Arc, Mutex};
|
||||
|
|
@ -778,10 +777,6 @@ impl RootActiveEventLoop for ActiveEventLoop {
|
|||
event_loop::OwnedDisplayHandle { platform: OwnedDisplayHandle }
|
||||
}
|
||||
|
||||
fn as_any(&self) -> &dyn Any {
|
||||
self
|
||||
}
|
||||
|
||||
#[cfg(feature = "rwh_06")]
|
||||
fn rwh_06_handle(&self) -> &dyn rwh_06::HasDisplayHandle {
|
||||
self
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
use std::any::Any;
|
||||
use std::cell::Cell;
|
||||
use std::clone::Clone;
|
||||
use std::iter;
|
||||
|
|
@ -693,10 +692,6 @@ impl RootActiveEventLoop for ActiveEventLoop {
|
|||
RootOwnedDisplayHandle { platform: OwnedDisplayHandle }
|
||||
}
|
||||
|
||||
fn as_any(&self) -> &dyn Any {
|
||||
self
|
||||
}
|
||||
|
||||
#[cfg(feature = "rwh_06")]
|
||||
fn rwh_06_handle(&self) -> &dyn rwh_06::HasDisplayHandle {
|
||||
self
|
||||
|
|
|
|||
|
|
@ -570,10 +570,6 @@ impl RootActiveEventLoop for ActiveEventLoop {
|
|||
RootOwnedDisplayHandle { platform: OwnedDisplayHandle }
|
||||
}
|
||||
|
||||
fn as_any(&self) -> &dyn std::any::Any {
|
||||
self
|
||||
}
|
||||
|
||||
fn rwh_06_handle(&self) -> &dyn rwh_06::HasDisplayHandle {
|
||||
self
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue