dope_core/executor/task/context/
pollcall.rs1use core::pin::Pin;
2
3use crate::executor::task::context::{self, Context};
4
5pub struct PollCall<'call, 'turn, 'd: 'turn, F> {
9 pub(in crate::executor::task) fiber: Pin<&'call mut F>,
10 pub(in crate::executor::task) context: &'call mut Context<'turn, 'd>,
11}
12
13impl<'call, 'turn, 'd: 'turn, F> PollCall<'call, 'turn, 'd, F> {
14 pub(in crate::executor) fn from_root(
15 fiber: Pin<&'call mut F>,
16 context: &'call mut Context<'turn, 'd>,
17 ) -> Self {
18 Self { fiber, context }
19 }
20
21 pub fn into_fiber(self) -> Pin<&'call mut F> {
22 self.fiber
23 }
24
25 pub fn into_context(self) -> &'call mut Context<'turn, 'd> {
26 self.context
27 }
28
29 pub fn into_parts(self) -> (Pin<&'call mut F>, &'call mut Context<'turn, 'd>) {
30 (self.fiber, self.context)
31 }
32
33 pub fn into_admit(self) -> (Pin<&'call mut F>, context::raw::Admission<'call, 'turn, 'd>) {
36 (
37 self.fiber,
38 context::raw::Admission {
39 context: self.context,
40 },
41 )
42 }
43}