windows_future/
when.rs

1use super::*;
2
3impl IAsyncAction {
4    /// Calls `op(result)` when the `IAsyncAction` completes.
5    pub fn when<F>(&self, op: F) -> Result<()>
6    where
7        F: FnOnce(Result<()>) + Send + 'static,
8    {
9        Async::when(self, op)
10    }
11}
12
13impl<T: RuntimeType> IAsyncOperation<T> {
14    /// Calls `op(result)` when the `IAsyncOperation<T>` completes.
15    pub fn when<F>(&self, op: F) -> Result<()>
16    where
17        F: FnOnce(Result<T>) + Send + 'static,
18    {
19        Async::when(self, op)
20    }
21}
22
23impl<P: RuntimeType> IAsyncActionWithProgress<P> {
24    /// Calls `op(result)` when the `IAsyncActionWithProgress<P>` completes.
25    pub fn when<F>(&self, op: F) -> Result<()>
26    where
27        F: FnOnce(Result<()>) + Send + 'static,
28    {
29        Async::when(self, op)
30    }
31}
32
33impl<T: RuntimeType, P: RuntimeType> IAsyncOperationWithProgress<T, P> {
34    /// Calls `op(result)` when the `IAsyncOperationWithProgress<T, P>` completes.
35    pub fn when<F>(&self, op: F) -> Result<()>
36    where
37        F: FnOnce(Result<T>) + Send + 'static,
38    {
39        Async::when(self, op)
40    }
41}