Remove generic parameter T from EventLoopWindowTarget (#3298)
This commit is contained in:
parent
169cd39f93
commit
22311802b5
37 changed files with 174 additions and 210 deletions
|
|
@ -48,9 +48,9 @@ pub struct EventLoop<T: 'static> {
|
|||
/// your callback. [`EventLoop`] will coerce into this type (`impl<T> Deref for
|
||||
/// EventLoop<T>`), so functions that take this as a parameter can also take
|
||||
/// `&EventLoop`.
|
||||
pub struct EventLoopWindowTarget<T: 'static> {
|
||||
pub(crate) p: platform_impl::EventLoopWindowTarget<T>,
|
||||
pub(crate) _marker: PhantomData<*mut T>, // Not Send nor Sync + invariant over T
|
||||
pub struct EventLoopWindowTarget {
|
||||
pub(crate) p: platform_impl::EventLoopWindowTarget,
|
||||
pub(crate) _marker: PhantomData<*mut ()>, // Not Send nor Sync
|
||||
}
|
||||
|
||||
/// Object that allows building the event loop.
|
||||
|
|
@ -142,7 +142,7 @@ impl<T> fmt::Debug for EventLoop<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T> fmt::Debug for EventLoopWindowTarget<T> {
|
||||
impl fmt::Debug for EventLoopWindowTarget {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.pad("EventLoopWindowTarget { .. }")
|
||||
}
|
||||
|
|
@ -241,7 +241,7 @@ impl<T> EventLoop<T> {
|
|||
#[cfg(not(all(wasm_platform, target_feature = "exception-handling")))]
|
||||
pub fn run<F>(self, event_handler: F) -> Result<(), EventLoopError>
|
||||
where
|
||||
F: FnMut(Event<T>, &EventLoopWindowTarget<T>),
|
||||
F: FnMut(Event<T>, &EventLoopWindowTarget),
|
||||
{
|
||||
self.event_loop.run(event_handler)
|
||||
}
|
||||
|
|
@ -298,13 +298,13 @@ impl<T> AsRawFd for EventLoop<T> {
|
|||
}
|
||||
|
||||
impl<T> Deref for EventLoop<T> {
|
||||
type Target = EventLoopWindowTarget<T>;
|
||||
fn deref(&self) -> &EventLoopWindowTarget<T> {
|
||||
type Target = EventLoopWindowTarget;
|
||||
fn deref(&self) -> &EventLoopWindowTarget {
|
||||
self.event_loop.window_target()
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> EventLoopWindowTarget<T> {
|
||||
impl EventLoopWindowTarget {
|
||||
/// Returns the list of all the monitors available on the system.
|
||||
#[inline]
|
||||
pub fn available_monitors(&self) -> impl Iterator<Item = MonitorHandle> {
|
||||
|
|
@ -370,7 +370,7 @@ impl<T> EventLoopWindowTarget<T> {
|
|||
}
|
||||
|
||||
#[cfg(feature = "rwh_06")]
|
||||
impl<T> rwh_06::HasDisplayHandle for EventLoopWindowTarget<T> {
|
||||
impl rwh_06::HasDisplayHandle for EventLoopWindowTarget {
|
||||
fn display_handle(&self) -> Result<rwh_06::DisplayHandle<'_>, rwh_06::HandleError> {
|
||||
let raw = self.p.raw_display_handle_rwh_06()?;
|
||||
// SAFETY: The display will never be deallocated while the event loop is alive.
|
||||
|
|
@ -379,7 +379,7 @@ impl<T> rwh_06::HasDisplayHandle for EventLoopWindowTarget<T> {
|
|||
}
|
||||
|
||||
#[cfg(feature = "rwh_05")]
|
||||
unsafe impl<T> rwh_05::HasRawDisplayHandle for EventLoopWindowTarget<T> {
|
||||
unsafe impl rwh_05::HasRawDisplayHandle for EventLoopWindowTarget {
|
||||
/// Returns a [`rwh_05::RawDisplayHandle`] for the event loop.
|
||||
fn raw_display_handle(&self) -> rwh_05::RawDisplayHandle {
|
||||
self.p.raw_display_handle_rwh_05()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue