Touch up some of the benchmarks

This commit is contained in:
Alex Crichton
2016-11-10 19:50:44 -08:00
parent 6b888ea20f
commit bbea632e04
3 changed files with 44 additions and 92 deletions
+14 -2
View File
@@ -6,8 +6,7 @@
use std::io;
use std::sync::mpsc::TryRecvError;
use futures::{Poll, Async};
use futures::stream::Stream;
use futures::{Poll, Async, Sink, AsyncSink, StartSend, Stream};
use mio::channel;
use reactor::{Handle, PollEvented};
@@ -82,6 +81,19 @@ impl<T> Sender<T> {
}
}
impl<T> Sink for Sender<T> {
type SinkItem = T;
type SinkError = io::Error;
fn start_send(&mut self, t: T) -> StartSend<T, io::Error> {
Sender::send(self, t).map(|()| AsyncSink::Ready)
}
fn poll_complete(&mut self) -> Poll<(), io::Error> {
Ok(().into())
}
}
impl<T> Clone for Sender<T> {
fn clone(&self) -> Sender<T> {
Sender { tx: self.tx.clone() }