]>
Commit | Line | Data |
---|---|---|
60c5eb7d | 1 | // check-pass |
c34b1796 AL |
2 | // pretty-expanded FIXME #23616 |
3 | ||
1a4d82fc JJ |
4 | pub trait Promisable: Send + Sync {} |
5 | impl<T: Send + Sync> Promisable for T {} | |
e9174d1e SL |
6 | |
7 | pub fn propagate<'a, T, E, F, G>(mut action: F) | |
dc9dc135 | 8 | -> Box<dyn FnMut(Result<T, E>) -> Result<T, E> + 'a> |
1a4d82fc | 9 | where |
85aaf69f SL |
10 | T: Promisable + Clone + 'a, |
11 | E: Promisable + Clone + 'a, | |
e9174d1e SL |
12 | F: FnMut(&T) -> Result<T, E> + Send + 'a, |
13 | G: FnMut(Result<T, E>) -> Result<T, E> + 'a { | |
c34b1796 | 14 | Box::new(move |result: Result<T, E>| { |
1a4d82fc JJ |
15 | match result { |
16 | Ok(ref t) => action(t), | |
17 | Err(ref e) => Err(e.clone()), | |
18 | } | |
19 | }) | |
20 | } | |
21 | ||
22 | fn main() {} |