struct Context {
thread_id: Cell<Option<ThreadId>>,
current: HandleCell,
scheduler: Scoped<Context>,
current_task_id: Cell<Option<Id>>,
runtime: Cell<EnterRuntime>,
rng: Cell<Option<FastRand>>,
budget: Cell<Budget>,
}
Fields§
§thread_id: Cell<Option<ThreadId>>
Uniquely identifies the current thread
current: HandleCell
Handle to the runtime scheduler running on the current thread.
scheduler: Scoped<Context>
Handle to the scheduler’s internal “context”
current_task_id: Cell<Option<Id>>
§runtime: Cell<EnterRuntime>
Tracks if the current thread is currently driving a runtime. Note, that if this is set to “entered”, the current scheduler handle may not reference the runtime currently executing. This is because other runtime handles may be set to current from within a runtime.
rng: Cell<Option<FastRand>>
§budget: Cell<Budget>
Tracks the amount of “work” a task may still do before yielding back to the scheduler
Implementations§
source§impl Context
impl Context
pub(super) fn set_current(&self, handle: &Handle) -> SetCurrentGuard
Auto Trait Implementations§
impl !Freeze for Context
impl !RefUnwindSafe for Context
impl !Send for Context
impl !Sync for Context
impl Unpin for Context
impl !UnwindSafe for Context
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