Skip to content

Commit

Permalink
Properly implement event loop extension traits
Browse files Browse the repository at this point in the history
This was implemented for `&dyn ActiveEventLoop` before, but that's less
general than implementing it directly for `dyn ActiveEventLoop`.

The `+ '_` is required to tell the compiler that we want to implement
this for all `dyn ActiveEventLoop`s, not just `'static` ones (even
though they're all going to be `'static`).
  • Loading branch information
madsmtm authored Aug 11, 2024
1 parent 70c54ee commit 038ef5c
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/platform/android.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ impl WindowExtAndroid for Window {
}
}

impl ActiveEventLoopExtAndroid for &dyn ActiveEventLoop {
impl ActiveEventLoopExtAndroid for dyn ActiveEventLoop + '_ {
fn android_app(&self) -> &AndroidApp {
let event_loop =
self.as_any().downcast_ref::<crate::platform_impl::ActiveEventLoop>().unwrap();
Expand Down
2 changes: 1 addition & 1 deletion src/platform/macos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ pub trait ActiveEventLoopExtMacOS {
fn allows_automatic_window_tabbing(&self) -> bool;
}

impl ActiveEventLoopExtMacOS for &dyn ActiveEventLoop {
impl ActiveEventLoopExtMacOS for dyn ActiveEventLoop + '_ {
fn hide_application(&self) {
let event_loop = self
.as_any()
Expand Down
2 changes: 1 addition & 1 deletion src/platform/startup_notify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub trait WindowAttributesExtStartupNotify {
fn with_activation_token(self, token: ActivationToken) -> Self;
}

impl EventLoopExtStartupNotify for &dyn ActiveEventLoop {
impl EventLoopExtStartupNotify for dyn ActiveEventLoop + '_ {
fn read_token_from_env(&self) -> Option<ActivationToken> {
#[cfg(x11_platform)]
let _is_wayland = false;
Expand Down
2 changes: 1 addition & 1 deletion src/platform/wayland.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub trait ActiveEventLoopExtWayland {
fn is_wayland(&self) -> bool;
}

impl ActiveEventLoopExtWayland for &dyn ActiveEventLoop {
impl ActiveEventLoopExtWayland for dyn ActiveEventLoop + '_ {
#[inline]
fn is_wayland(&self) -> bool {
self.as_any().downcast_ref::<crate::platform_impl::wayland::ActiveEventLoop>().is_some()
Expand Down
2 changes: 1 addition & 1 deletion src/platform/web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ pub trait ActiveEventLoopExtWeb {
fn has_detailed_monitor_permission(&self) -> bool;
}

impl ActiveEventLoopExtWeb for &dyn ActiveEventLoop {
impl ActiveEventLoopExtWeb for dyn ActiveEventLoop + '_ {
#[inline]
fn create_custom_cursor_async(&self, source: CustomCursorSource) -> CustomCursorFuture {
let event_loop = self
Expand Down
2 changes: 1 addition & 1 deletion src/platform/x11.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ pub trait ActiveEventLoopExtX11 {
fn is_x11(&self) -> bool;
}

impl ActiveEventLoopExtX11 for &dyn ActiveEventLoop {
impl ActiveEventLoopExtX11 for dyn ActiveEventLoop + '_ {
#[inline]
fn is_x11(&self) -> bool {
self.as_any().downcast_ref::<crate::platform_impl::x11::ActiveEventLoop>().is_some()
Expand Down

0 comments on commit 038ef5c

Please sign in to comment.