moro/
scope_body.rs

1use std::pin::Pin;
2
3use futures::Future;
4
5use crate::body::Body;
6
7pub struct ScopeBody<'env, R: 'env>
8where
9    R: Send,
10{
11    body: Body<'env, 'env, R>,
12}
13
14impl<'env, R> ScopeBody<'env, R>
15where
16    R: Send,
17{
18    pub(crate) fn new(body: Body<'env, 'env, R>) -> Self {
19        Self { body }
20    }
21}
22
23impl<'env, R> Future for ScopeBody<'env, R>
24where
25    R: Send,
26{
27    type Output = R;
28
29    fn poll(
30        self: std::pin::Pin<&mut Self>,
31        cx: &mut std::task::Context<'_>,
32    ) -> std::task::Poll<Self::Output> {
33        Pin::new(&mut self.get_mut().body).poll(cx)
34    }
35}
36
37impl<R: Send> Unpin for ScopeBody<'_, R> {}