mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-19 00:00:14 +02:00
websocket: add a wrapper around is_terminated (#3443)
Co-authored-by: Loic <[email protected]> Co-authored-by: loikki <[email protected]>
This commit is contained in:
co-authored by
Loic
loikki
parent
ab593bbab7
commit
e43030d051
@@ -94,7 +94,7 @@ use self::rejection::*;
|
||||
use super::FromRequestParts;
|
||||
use crate::{body::Bytes, response::Response, Error};
|
||||
use axum_core::body::Body;
|
||||
use futures_core::Stream;
|
||||
use futures_core::{FusedStream, Stream};
|
||||
use futures_sink::Sink;
|
||||
use futures_util::{sink::SinkExt, stream::StreamExt};
|
||||
use http::{
|
||||
@@ -530,6 +530,13 @@ impl WebSocket {
|
||||
}
|
||||
}
|
||||
|
||||
impl FusedStream for WebSocket {
|
||||
/// Returns true if the websocket has been terminated.
|
||||
fn is_terminated(&self) -> bool {
|
||||
self.inner.is_terminated()
|
||||
}
|
||||
}
|
||||
|
||||
impl Stream for WebSocket {
|
||||
type Item = Result<Message, Error>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user