Add as fn trait function

This commit is contained in:
hodasemi 2024-04-11 13:35:44 +02:00
parent 06bafe40b9
commit c47ed815b6

View file

@ -11,6 +11,13 @@ pub trait FutureStateChange: Fn() -> Result<()> + Send + Sync {
fn clone_box<'a>(&self) -> Box<dyn 'a + FutureStateChange> fn clone_box<'a>(&self) -> Box<dyn 'a + FutureStateChange>
where where
Self: 'a; Self: 'a;
fn as_fn(&self) -> &(dyn Fn() -> Result<()> + Send + Sync)
where
Self: Sized,
{
self
}
} }
impl<F: Fn() -> Result<()> + Clone + Send + Sync> FutureStateChange for F { impl<F: Fn() -> Result<()> + Clone + Send + Sync> FutureStateChange for F {