#[repr(C)]pub(super) struct Core<T: Future, S> {
pub(super) scheduler: S,
pub(super) task_id: Id,
pub(super) stage: CoreStage<T>,
}
Expand description
The core of the task.
Holds the future or output, depending on the stage of execution.
Any changes to the layout of this struct must also be reflected in the
const
fns in raw.rs.
Fields§
§scheduler: S
Scheduler used to drive this future.
task_id: Id
The task’s ID, used for populating JoinError
s.
stage: CoreStage<T>
Either the future or the output.
Implementations§
source§impl<T: Future, S: Schedule> Core<T, S>
impl<T: Future, S: Schedule> Core<T, S>
sourcepub(super) fn poll(&self, cx: Context<'_>) -> Poll<T::Output>
pub(super) fn poll(&self, cx: Context<'_>) -> Poll<T::Output>
Polls the future.
§Safety
The caller must ensure it is safe to mutate the state
field. This
requires ensuring mutual exclusion between any concurrent thread that
might modify the future or output field.
The mutual exclusion is implemented by Harness
and the Lifecycle
component of the task state.
self
must also be pinned. This is handled by storing the task on the
heap.
sourcepub(super) fn drop_future_or_output(&self)
pub(super) fn drop_future_or_output(&self)
sourcepub(super) fn store_output(&self, output: Result<T::Output, JoinError>)
pub(super) fn store_output(&self, output: Result<T::Output, JoinError>)
sourcepub(super) fn take_output(&self) -> Result<T::Output, JoinError>
pub(super) fn take_output(&self) -> Result<T::Output, JoinError>
unsafe fn set_stage(&self, stage: Stage<T>)
Auto Trait Implementations§
impl<T, S> !Freeze for Core<T, S>
impl<T, S> !RefUnwindSafe for Core<T, S>
impl<T, S> Send for Core<T, S>
impl<T, S> !Sync for Core<T, S>
impl<T, S> Unpin for Core<T, S>
impl<T, S> !UnwindSafe for Core<T, S>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more