diff --git a/src/lib.rs b/src/lib.rs index f6919ce..73458db 100644 --- a/src/lib.rs +++ b/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 FusedStream for WebSocketStream +where + T: AsyncRead + AsyncWrite + Unpin, +{ + fn is_terminated(&self) -> bool { + self.ended + } +} + impl Sink for WebSocketStream where T: AsyncRead + AsyncWrite + Unpin,