Struct completion::Adapter[][src]

pub struct Adapter<T>(pub T);

Helper type to implement CompletionFuture or CompletionStream for a type that only implements Future or Stream.

This is typically created through the FutureExt::into_completion and StreamExt::into_completion methods.

Examples

// This future doesn't implement `CompletionFuture`, so to use it in `block_on` we need to wrap
// it in Adapter.
let future = async {};
completion::future::block_on(completion::Adapter(future));

Implementations

impl<T> Adapter<T>[src]

#[must_use]pub fn get_pin_ref(self: Pin<&Self>) -> Pin<&T>[src]

Get a pinned shared reference to the inner future or stream.

#[must_use]pub fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut T>[src]

Get a pinned mutable reference to the inner future or stream.

Trait Implementations

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

impl<T: Future> CompletionFuture for Adapter<T>[src]

type Output = T::Output

The type of value produced on completion.

impl<T: Stream> CompletionStream for Adapter<T>[src]

type Item = T::Item

Values yielded by the stream.

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

impl<T: Future> Future for Adapter<T>[src]

type Output = T::Output

The type of value produced on completion.

impl<T: Stream> Stream for Adapter<T>[src]

type Item = T::Item

Values yielded by the stream.

Auto Trait Implementations

impl<T> RefUnwindSafe for Adapter<T> where
    T: RefUnwindSafe

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

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

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

impl<T> UnwindSafe for Adapter<T> where
    T: 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> CompletionFutureExt for T where
    T: CompletionFuture + ?Sized
[src]

impl<T> CompletionStreamExt for T where
    T: CompletionStream + ?Sized
[src]

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

impl<T> FutureExt for T where
    T: Future
[src]

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

impl<F> IntoFuture for F where
    F: Future
[src]

type Output = <F as Future>::Output

🔬 This is a nightly-only experimental API. (into_future)

The output that the future will produce on completion.

type Future = F

🔬 This is a nightly-only experimental API. (into_future)

Which kind of future are we turning this into?

impl<T> StreamExt for T where
    T: Stream
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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<F, T, E> TryFuture for F where
    F: Future<Output = Result<T, E>> + ?Sized
[src]

type Ok = T

The type of successful values yielded by this future

type Error = E

The type of failures yielded by this future

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.

impl<S, T, E> TryStream for S where
    S: Stream<Item = Result<T, E>> + ?Sized
[src]

type Ok = T

The type of successful values yielded by this future

type Error = E

The type of failures yielded by this future