Enum core::task::Poll1.36.0[][src]

#[must_use = "this `Poll` may be a `Pending` variant, which should be handled"]
pub enum Poll<T> {
    Ready(T),
    Pending,
}

Indicates whether a value is available or if the current task has been scheduled to receive a wakeup instead.

Variants

Ready(T)

Represents that a value is immediately ready.

Pending

Represents that a value is not ready yet.

When a function returns Pending, the function must also ensure that the current task is scheduled to be awoken when progress can be made.

Implementations

impl<T> Poll<T>[src]

pub fn map<U, F>(self, f: F) -> Poll<U> where
    F: FnOnce(T) -> U, 
[src]

Changes the ready value of this Poll with the closure provided.

pub const fn is_ready(&self) -> bool1.36.0 (const: 1.49.0)[src]

Returns true if this is Poll::Ready

pub const fn is_pending(&self) -> bool1.36.0 (const: 1.49.0)[src]

Returns true if this is Poll::Pending

impl<T, E> Poll<Result<T, E>>[src]

pub fn map_ok<U, F>(self, f: F) -> Poll<Result<U, E>> where
    F: FnOnce(T) -> U, 
[src]

Changes the success value of this Poll with the closure provided.

pub fn map_err<U, F>(self, f: F) -> Poll<Result<T, U>> where
    F: FnOnce(E) -> U, 
[src]

Changes the error value of this Poll with the closure provided.

impl<T, E> Poll<Option<Result<T, E>>>[src]

pub fn map_ok<U, F>(self, f: F) -> Poll<Option<Result<U, E>>> where
    F: FnOnce(T) -> U, 
1.51.0[src]

Changes the success value of this Poll with the closure provided.

pub fn map_err<U, F>(self, f: F) -> Poll<Option<Result<T, U>>> where
    F: FnOnce(E) -> U, 
1.51.0[src]

Changes the error value of this Poll with the closure provided.

Trait Implementations

impl<T: Clone> Clone for Poll<T>[src]

fn clone(&self) -> Poll<T>[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<T: Debug> Debug for Poll<T>[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<T> From<T> for Poll<T>[src]

fn from(t: T) -> Poll<T>[src]

Convert to a Ready variant.

Example

assert_eq!(Poll::from(true), Poll::Ready(true));
Run

impl<T, E, F: From<E>> FromResidual<Result<Infallible, E>> for Poll<Result<T, F>>[src]

fn from_residual(x: Result<Infallible, E>) -> Self[src]

🔬 This is a nightly-only experimental API. (try_trait_v2 #84277)

Constructs the type from a compatible Residual type. Read more

impl<T, E, F: From<E>> FromResidual<Result<Infallible, E>> for Poll<Option<Result<T, F>>>[src]

fn from_residual(x: Result<Infallible, E>) -> Self[src]

🔬 This is a nightly-only experimental API. (try_trait_v2 #84277)

Constructs the type from a compatible Residual type. Read more

impl<T: Hash> Hash for Poll<T>[src]

fn hash<__H: Hasher>(&self, state: &mut __H)[src]

Feeds this value into the given Hasher. Read more

fn hash_slice<H: Hasher>(data: &[Self], state: &mut H) where
    Self: Sized
1.3.0[src]

Feeds a slice of this type into the given Hasher. Read more

impl<T: Ord> Ord for Poll<T>[src]

fn cmp(&self, other: &Poll<T>) -> Ordering[src]

This method returns an Ordering between self and other. Read more

#[must_use]
fn max(self, other: Self) -> Self where
    Self: Sized
1.21.0[src]

Compares and returns the maximum of two values. Read more

#[must_use]
fn min(self, other: Self) -> Self where
    Self: Sized
1.21.0[src]

Compares and returns the minimum of two values. Read more

#[must_use]
fn clamp(self, min: Self, max: Self) -> Self where
    Self: Sized
1.50.0[src]

Restrict a value to a certain interval. Read more

impl<T: PartialEq> PartialEq<Poll<T>> for Poll<T>[src]

fn eq(&self, other: &Poll<T>) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &Poll<T>) -> bool[src]

This method tests for !=.

impl<T: PartialOrd> PartialOrd<Poll<T>> for Poll<T>[src]

fn partial_cmp(&self, other: &Poll<T>) -> Option<Ordering>[src]

This method returns an ordering between self and other values if one exists. Read more

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than (for self and other) and is used by the < operator. Read more

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl<T, E> Try for Poll<Result<T, E>>[src]

type Ok = Poll<T>

🔬 This is a nightly-only experimental API. (try_trait #42327)

The type of this value when viewed as successful.

type Error = E

🔬 This is a nightly-only experimental API. (try_trait #42327)

The type of this value when viewed as failed.

fn into_result(self) -> Result<Self::Ok, Self::Error>[src]

🔬 This is a nightly-only experimental API. (try_trait #42327)

Applies the “?” operator. A return of Ok(t) means that the execution should continue normally, and the result of ? is the value t. A return of Err(e) means that execution should branch to the innermost enclosing catch, or return from the function. Read more

fn from_error(e: Self::Error) -> Self[src]

🔬 This is a nightly-only experimental API. (try_trait #42327)

Wrap an error value to construct the composite result. For example, Result::Err(x) and Result::from_error(x) are equivalent. Read more

fn from_ok(x: Self::Ok) -> Self[src]

🔬 This is a nightly-only experimental API. (try_trait #42327)

Wrap an OK value to construct the composite result. For example, Result::Ok(x) and Result::from_ok(x) are equivalent. Read more

impl<T, E> Try for Poll<Option<Result<T, E>>>[src]

type Ok = Poll<Option<T>>

🔬 This is a nightly-only experimental API. (try_trait #42327)

The type of this value when viewed as successful.

type Error = E

🔬 This is a nightly-only experimental API. (try_trait #42327)

The type of this value when viewed as failed.

fn into_result(self) -> Result<Self::Ok, Self::Error>[src]

🔬 This is a nightly-only experimental API. (try_trait #42327)

Applies the “?” operator. A return of Ok(t) means that the execution should continue normally, and the result of ? is the value t. A return of Err(e) means that execution should branch to the innermost enclosing catch, or return from the function. Read more

fn from_error(e: Self::Error) -> Self[src]

🔬 This is a nightly-only experimental API. (try_trait #42327)

Wrap an error value to construct the composite result. For example, Result::Err(x) and Result::from_error(x) are equivalent. Read more

fn from_ok(x: Self::Ok) -> Self[src]

🔬 This is a nightly-only experimental API. (try_trait #42327)

Wrap an OK value to construct the composite result. For example, Result::Ok(x) and Result::from_ok(x) are equivalent. Read more

impl<T, E> Try for Poll<Result<T, E>>[src]

type Output = Poll<T>

🔬 This is a nightly-only experimental API. (try_trait_v2 #84277)

The type of the value produced by ? when not short-circuiting.

type Residual = Result<Infallible, E>

🔬 This is a nightly-only experimental API. (try_trait_v2 #84277)

The type of the value passed to FromResidual::from_residual as part of ? when short-circuiting. Read more

fn from_output(c: Self::Output) -> Self[src]

🔬 This is a nightly-only experimental API. (try_trait_v2 #84277)

Constructs the type from its Output type. Read more

fn branch(self) -> ControlFlow<Self::Residual, Self::Output>[src]

🔬 This is a nightly-only experimental API. (try_trait_v2 #84277)

Used in ? to decide whether the operator should produce a value (because this returned ControlFlow::Continue) or propagate a value back to the caller (because this returned ControlFlow::Break). Read more

impl<T, E> Try for Poll<Option<Result<T, E>>>[src]

type Output = Poll<Option<T>>

🔬 This is a nightly-only experimental API. (try_trait_v2 #84277)

The type of the value produced by ? when not short-circuiting.

type Residual = Result<Infallible, E>

🔬 This is a nightly-only experimental API. (try_trait_v2 #84277)

The type of the value passed to FromResidual::from_residual as part of ? when short-circuiting. Read more

fn from_output(c: Self::Output) -> Self[src]

🔬 This is a nightly-only experimental API. (try_trait_v2 #84277)

Constructs the type from its Output type. Read more

fn branch(self) -> ControlFlow<Self::Residual, Self::Output>[src]

🔬 This is a nightly-only experimental API. (try_trait_v2 #84277)

Used in ? to decide whether the operator should produce a value (because this returned ControlFlow::Continue) or propagate a value back to the caller (because this returned ControlFlow::Break). Read more

impl<T: Copy> Copy for Poll<T>[src]

impl<T: Eq> Eq for Poll<T>[src]

impl<T> StructuralEq for Poll<T>[src]

impl<T> StructuralPartialEq for Poll<T>[src]

Auto Trait Implementations

impl<T> Send for Poll<T> where
    T: Send

impl<T> Sync for Poll<T> where
    T: Sync

impl<T> Unpin for Poll<T> where
    T: Unpin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&Self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&Self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut Self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<!> for T[src]

pub fn from(!) -> T[src]

Performs the conversion.

impl<T> From<T> for T[src]

pub fn from(T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(Self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

pub fn try_into(Self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.