Implement the `FusedStream` along with `Stream`

pull/110/head
Daniel Abramov 3 years ago committed by Sebastian Dröge
parent 3c150d1174
commit 38bfaa4f10
  1. 11
      src/lib.rs

@ -63,7 +63,7 @@ use compat::{cvt, AllowStd, ContextWaker};
use futures_io::{AsyncRead, AsyncWrite};
use futures_util::{
sink::{Sink, SinkExt},
stream::Stream,
stream::{FusedStream, Stream},
};
use log::*;
use std::pin::Pin;
@ -343,6 +343,15 @@ where
}
}
impl<T> FusedStream for WebSocketStream<T>
where
T: AsyncRead + AsyncWrite + Unpin,
{
fn is_terminated(&self) -> bool {
self.ended
}
}
impl<T> Sink<Message> for WebSocketStream<T>
where
T: AsyncRead + AsyncWrite + Unpin,

Loading…
Cancel
Save