[][src]Struct ufut::Or

#[must_use = "futures do nothing unless you `.await` or poll them"]pub struct Or<F1, F2> { /* fields omitted */ }

Returns the result of left or right future, preferring left if both are ready.

Implementations

impl<F1, F2> Or<F1, F2> where
    F1: Future,
    F2: Future
[src]

pub fn new(future1: F1, future2: F2) -> Or<F1, F2>

Notable traits for Or<F1, F2>

impl<T, F1, F2> Future for Or<F1, F2> where
    F1: Future<Output = T>,
    F2: Future<Output = T>, 
type Output = T;
[src]

Returns the result of left or right future, preferring left if both are ready.

Examples

use futures_micro::prelude::{Or, pending, ready};

assert_eq!(Or::new(ready(1), pending::<i32>()).await, 1);
assert_eq!(Or::new(pending::<i32>(), ready(2)).await, 2);

// The first future wins.
assert_eq!(Or::new(ready(1), ready(2)).await, 1);

Trait Implementations

impl<F1, F2> Debug for Or<F1, F2> where
    F1: Debug,
    F2: Debug
[src]

impl<T, F1, F2> Future for Or<F1, F2> where
    F1: Future<Output = T>,
    F2: Future<Output = T>, 
[src]

type Output = T

The type of value produced on completion.

Auto Trait Implementations

impl<F1, F2> RefUnwindSafe for Or<F1, F2> where
    F1: RefUnwindSafe,
    F2: RefUnwindSafe

impl<F1, F2> Send for Or<F1, F2> where
    F1: Send,
    F2: Send

impl<F1, F2> Sync for Or<F1, F2> where
    F1: Sync,
    F2: Sync

impl<F1, F2> Unpin for Or<F1, F2> where
    F1: Unpin,
    F2: Unpin

impl<F1, F2> UnwindSafe for Or<F1, F2> where
    F1: UnwindSafe,
    F2: UnwindSafe

Blanket Implementations

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

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

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

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

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

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.

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.