diff --git a/src/elements/callback_builder.rs b/src/elements/callback_builder.rs index b36b020..ee68db0 100644 --- a/src/elements/callback_builder.rs +++ b/src/elements/callback_builder.rs @@ -3,6 +3,7 @@ use std::any::Any; use anyhow::Result; use super::ControllerButton; +use crate::prelude::*; macro_rules! callbacks { ($name:ident, $($cb:tt)*) => { @@ -26,7 +27,7 @@ macro_rules! callbacks { }; } -callbacks!(ClickCallbacks, Fn() -> Result<()> + Send + Sync); +callbacks!(ClickCallbacks, Fn(&mut GuiHandler) -> Result<()> + Send + Sync); callbacks!(SelectCallbacks, Fn(bool) -> anyhow::Result<()> + Send + Sync); callbacks!(CustomCallbacks, Fn(ControllerButton) -> anyhow::Result + Send + Sync); callbacks!(VecCallbacks, Fn(&dyn Any) -> Result<()> + Send + Sync); @@ -36,8 +37,8 @@ mod test { use super::*; use anyhow::Result; - fn normal_fn() -> impl Fn() -> Result<()> + Send + Sync { - || Ok(()) + fn normal_fn() -> impl Fn(&mut GuiHandler) -> Result<()> + Send + Sync { + |_| Ok(()) } #[test] @@ -47,7 +48,10 @@ 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(()) }