pub struct PollImmediate<T> { /* private fields */ }
Expand description

Future for the poll_immediate function.

It will never return Poll::Pending

Trait Implementations§

source§

impl<T: Clone> Clone for PollImmediate<T>

source§

fn clone(&self) -> PollImmediate<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: Debug> Debug for PollImmediate<T>

source§

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

Formats the value using the given formatter. Read more
source§

impl<T: Future> FusedFuture for PollImmediate<T>

source§

fn is_terminated(&self) -> bool

Returns true if the underlying future should no longer be polled.
source§

impl<T, F> Future for PollImmediate<F>where F: Future<Output = T>,

§

type Output = Option<T>

The type of value produced on completion.
source§

fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<T>>

Attempt to resolve the future to a final value, registering the current task for wakeup if the value is not yet available. Read more
source§

impl<T, F> Stream for PollImmediate<F>where F: Future<Output = T>,

A Stream implementation that can be polled repeatedly until the future is done. The stream will never return Poll::Pending so polling it in a tight loop is worse than using a blocking synchronous function.

use futures::task::Poll;
use futures::{StreamExt, future, pin_mut};
use future::FusedFuture;

let f = async { 1_u32 };
pin_mut!(f);
let mut r = future::poll_immediate(f);
assert_eq!(r.next().await, Some(Poll::Ready(1)));

let f = async {futures::pending!(); 42_u8};
pin_mut!(f);
let mut p = future::poll_immediate(f);
assert_eq!(p.next().await, Some(Poll::Pending));
assert!(!p.is_terminated());
assert_eq!(p.next().await, Some(Poll::Ready(42)));
assert!(p.is_terminated());
assert_eq!(p.next().await, None);
§

type Item = Poll<T>

Values yielded by the stream.
source§

fn poll_next( self: Pin<&mut Self>, cx: &mut Context<'_> ) -> Poll<Option<Self::Item>>

Attempt to pull out the next value of this stream, registering the current task for wakeup if the value is not yet available, and returning None if the stream is exhausted. Read more
source§

fn size_hint(&self) -> (usize, Option<usize>)

Returns the bounds on the remaining length of the stream. Read more
source§

impl<'__pin, T> Unpin for PollImmediate<T>where __Origin<'__pin, T>: Unpin,

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for PollImmediate<T>where T: RefUnwindSafe,

§

impl<T> Send for PollImmediate<T>where T: Send,

§

impl<T> Sync for PollImmediate<T>where T: Sync,

§

impl<T> UnwindSafe for PollImmediate<T>where T: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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<F> IntoFuture for Fwhere F: Future,

§

type Output = <F as Future>::Output

The output that the future will produce on completion.
§

type IntoFuture = F

Which kind of future are we turning this into?
source§

fn into_future(self) -> <F as IntoFuture>::IntoFuture

Creates a future from a value. Read more
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.