viz_core/handler/
after.rs1use crate::{Handler, Result};
2
3#[derive(Debug, Clone)]
5pub struct After<H, F> {
6 h: H,
7 f: F,
8}
9
10impl<H, F> After<H, F> {
11 #[inline]
13 pub const fn new(h: H, f: F) -> Self {
14 Self { h, f }
15 }
16}
17
18#[crate::async_trait]
19impl<H, F, I, O> Handler<I> for After<H, F>
20where
21 I: Send + 'static,
22 H: Handler<I, Output = Result<O>>,
23 F: Handler<H::Output, Output = H::Output>,
24{
25 type Output = F::Output;
26
27 async fn call(&self, i: I) -> Self::Output {
28 self.f.call(self.h.call(i).await).await
29 }
30}