use core::pin::Pin;
use crate::executor::task::context::{self, Context};
pub struct PollCall<'call, 'turn, 'd: 'turn, F> {
pub(in crate::executor::task) fiber: Pin<&'call mut F>,
pub(in crate::executor::task) context: &'call mut Context<'turn, 'd>,
}
impl<'call, 'turn, 'd, F> PollCall<'call, 'turn, 'd, F> {
pub(in crate::executor) fn from_root(
fiber: Pin<&'call mut F>,
context: &'call mut Context<'turn, 'd>,
) -> Self {
Self { fiber, context }
}
pub fn into_fiber(self) -> Pin<&'call mut F> {
self.fiber
}
pub fn into_context(self) -> &'call mut Context<'turn, 'd> {
self.context
}
pub fn into_parts(self) -> (Pin<&'call mut F>, &'call mut Context<'turn, 'd>) {
(self.fiber, self.context)
}
pub fn into_admit(self) -> (Pin<&'call mut F>, context::raw::Admission<'call, 'turn, 'd>) {
(
self.fiber,
context::raw::Admission {
context: self.context,
},
)
}
}