[][src]Trait futures::compat::Sink01CompatExt

pub trait Sink01CompatExt: Sink {
    default fn sink_compat(self) -> Compat01As03Sink<Self, Self::SinkItem> { ... }
}

Extension trait for futures 0.1 Sink

Provided methods

default fn sink_compat(self) -> Compat01As03Sink<Self, Self::SinkItem>

Converts a futures 0.1 Sink<SinkItem = T, SinkError = E> into a futures 0.3 Sink<SinkItem = T, SinkError = E>.

#![feature(async_await, await_macro, futures_api)]
use futures::{sink::SinkExt, stream::StreamExt};
use futures_util::compat::{Stream01CompatExt, Sink01CompatExt};

let (tx, rx) = futures_01::unsync::mpsc::channel(1);
let (mut tx, mut rx) = (tx.sink_compat(), rx.compat());

await!(tx.send(1)).unwrap();
drop(tx);
assert_eq!(await!(rx.next()), Some(Ok(1)));
assert_eq!(await!(rx.next()), None);
Loading content...

Implementors

impl<Si> Sink01CompatExt for Si where
    Si: Sink
[src]

default fn sink_compat(self) -> Compat01As03Sink<Self, Self::SinkItem>[src]

Loading content...