Struct futures_util::future::PollImmediate
source · [−]pub struct PollImmediate<T> { /* private fields */ }
Expand description
Future for the poll_immediate
function.
It will never return Poll::Pending
Trait Implementations
sourceimpl<T: Clone> Clone for PollImmediate<T>
impl<T: Clone> Clone for PollImmediate<T>
sourcefn clone(&self) -> PollImmediate<T>ⓘNotable traits for PollImmediate<F>impl<T, F> Future for PollImmediate<F> where
F: Future<Output = T>, type Output = Option<T>;
fn clone(&self) -> PollImmediate<T>ⓘNotable traits for PollImmediate<F>impl<T, F> Future for PollImmediate<F> where
F: Future<Output = T>, type Output = Option<T>;
F: Future<Output = T>, type Output = Option<T>;
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<T: Debug> Debug for PollImmediate<T>
impl<T: Debug> Debug for PollImmediate<T>
sourceimpl<T: Future> FusedFuture for PollImmediate<T>
impl<T: Future> FusedFuture for PollImmediate<T>
sourcefn is_terminated(&self) -> bool
fn is_terminated(&self) -> bool
Returns true
if the underlying future should no longer be polled.
sourceimpl<T, F> Future for PollImmediate<F> where
F: Future<Output = T>,
impl<T, F> Future for PollImmediate<F> where
F: Future<Output = T>,
sourceimpl<T, F> Stream for PollImmediate<F> where
F: Future<Output = T>,
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);
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<F> IntoFuture for F where
F: Future,
impl<F> IntoFuture for F where
F: Future,
type Output = <F as Future>::Output
type Output = <F as Future>::Output
into_future
)The output that the future will produce on completion.
type Future = F
type Future = F
into_future
)Which kind of future are we turning this into?
sourcepub fn into_future(self) -> <F as IntoFuture>::Future
pub fn into_future(self) -> <F as IntoFuture>::Future
into_future
)Creates a future from a value.
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more