From ffda082363b499b4d3d6ea25fb57bd98471c5059 Mon Sep 17 00:00:00 2001 From: hodasemi Date: Tue, 16 Apr 2024 10:19:58 +0200 Subject: [PATCH] Add static cast --- src/states.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/states.rs b/src/states.rs index 4f79763..76e9eec 100644 --- a/src/states.rs +++ b/src/states.rs @@ -18,6 +18,13 @@ pub trait FutureStateChange: Fn() -> Result<()> + Send + Sync { { self } + + fn as_static(&'static self) -> &'static (dyn Fn() -> Result<()> + Send + Sync + 'static) + where + Self: Sized, + { + self + } } impl Result<()> + Clone + Send + Sync> FutureStateChange for F {