From 682859767210943b07378bd28840d20105639155 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20H=C3=BCbner?= Date: Wed, 5 Mar 2025 08:25:28 +0100 Subject: [PATCH] Fix callbackbuilder --- src/elements/callback_builder.rs | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/elements/callback_builder.rs b/src/elements/callback_builder.rs index 45156d9..c63a68e 100644 --- a/src/elements/callback_builder.rs +++ b/src/elements/callback_builder.rs @@ -4,7 +4,6 @@ use anyhow::Result; use ecs::World; use super::ControllerButton; -use crate::prelude::*; macro_rules! callbacks { ($name:ident, $($cb:tt)*) => { @@ -28,12 +27,12 @@ macro_rules! callbacks { }; } -callbacks!(ClickCallbacks, Fn(&mut World, &mut GuiHandler) -> Result<()> + Send + Sync); -callbacks!(SelectCallbacks, Fn(&mut World, &mut GuiHandler, bool) -> anyhow::Result<()> + Send + Sync); -callbacks!(CustomCallbacks, Fn(&mut World, &mut GuiHandler, ControllerButton) -> anyhow::Result + Send + Sync); +callbacks!(ClickCallbacks, Fn(&mut World) -> Result<()> + Send + Sync); +callbacks!(SelectCallbacks, Fn(&mut World, bool) -> anyhow::Result<()> + Send + Sync); +callbacks!(CustomCallbacks, Fn(&mut World, ControllerButton) -> anyhow::Result + Send + Sync); callbacks!( VecCallbacks, - Fn(&mut World, &mut GuiHandler, &dyn Any) -> Result<()> + Send + Sync + Fn(&mut World, &dyn Any) -> Result<()> + Send + Sync ); #[cfg(test)] @@ -41,8 +40,8 @@ mod test { use super::*; use anyhow::Result; - fn normal_fn() -> impl Fn(&mut World, &mut GuiHandler) -> Result<()> + Send + Sync { - |_, _| Ok(()) + fn normal_fn() -> impl Fn(&mut World) -> Result<()> + Send + Sync { + |_| Ok(()) } #[test] @@ -52,10 +51,7 @@ mod test { impl Test { fn set_click_callbacks( &self, - _callbacks: Vec<( - &str, - Box Result<()> + Send + Sync>, - )>, + _callbacks: Vec<(&str, Box Result<()> + Send + Sync>)>, ) -> Result<()> { Ok(()) }