Add as fn trait function
This commit is contained in:
parent
06bafe40b9
commit
c47ed815b6
1 changed files with 7 additions and 0 deletions
|
@ -11,6 +11,13 @@ pub trait FutureStateChange: Fn() -> Result<()> + Send + Sync {
|
|||
fn clone_box<'a>(&self) -> Box<dyn 'a + FutureStateChange>
|
||||
where
|
||||
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 {
|
||||
|
|
Loading…
Reference in a new issue