Skip to main content

Cx

Struct Cx 

Source
pub struct Cx<'poll, 'env, R> {
    pub resources: &'poll mut R,
    /* private fields */
}
Expand description

The poll context for tasks.

Fields§

§resources: &'poll mut R

Implementations§

Source§

impl<'poll, 'env, R> Cx<'poll, 'env, R>

Source

pub fn id(&self) -> TaskId

Source

pub fn wake(&self, id: TaskId)

Source

pub fn wake_self(&self)

Source

pub fn yield_now(&self) -> TaskPoll

Yield to the scheduler and reschedule yourself.

Source

pub fn wake_sender(&self) -> WakeSender

Source

pub fn subscribe_to_finish(&mut self, target_task: TaskId)

Source

pub fn spawn_later_named<T>(&mut self, name: impl Into<String>, task: T)
where T: ScopedTask<'env, R> + 'env,

Source

pub fn task_state(&mut self, id: TaskId) -> TaskState

Source

pub fn wait_readable(&mut self, token: usize)

Source

pub fn sleep_until(&mut self, deadline: Instant)

Source

pub fn sleep_for(&mut self, dur: Duration)

Source

pub fn is_cancelled(&self) -> bool

Source

pub fn cancel(&mut self, task: TaskId)

Best-effort cancel (no additional escalation beyond whatever the scope defaults are).

Source

pub fn cancel_with_reason(&mut self, task: TaskId, reason: CancelReason)

Source

pub fn cancel_escalate_with(&mut self, task: TaskId, esc: CancelEscalation)

Source

pub fn cancel_escalate_with_reason( &mut self, task: TaskId, esc: CancelEscalation, reason: CancelReason, )

Auto Trait Implementations§

§

impl<'poll, 'env, R> Freeze for Cx<'poll, 'env, R>

§

impl<'poll, 'env, R> !RefUnwindSafe for Cx<'poll, 'env, R>

§

impl<'poll, 'env, R> !Send for Cx<'poll, 'env, R>

§

impl<'poll, 'env, R> !Sync for Cx<'poll, 'env, R>

§

impl<'poll, 'env, R> Unpin for Cx<'poll, 'env, R>

§

impl<'poll, 'env, R> !UnwindSafe for Cx<'poll, 'env, R>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.