Try removing unpin

pull/73/head
Danny Browning 5 years ago
parent 614a5068fa
commit 02684b4946
  1. 4
      src/client.rs
  2. 4
      src/handshake/client.rs
  3. 2
      src/handshake/mod.rs
  4. 4
      src/handshake/server.rs
  5. 8
      src/server.rs

@ -179,7 +179,7 @@ pub fn client_with_config<'t, Stream, Req>(
config: Option<WebSocketConfig>, config: Option<WebSocketConfig>,
) -> StdResult<(WebSocket<Stream>, Response), HandshakeError<ClientHandshake<Stream>>> ) -> StdResult<(WebSocket<Stream>, Response), HandshakeError<ClientHandshake<Stream>>>
where where
Stream: Read + Write + Unpin, Stream: Read + Write,
Req: Into<Request<'t>>, Req: Into<Request<'t>>,
{ {
ClientHandshake::start(stream, request.into(), config).handshake() ClientHandshake::start(stream, request.into(), config).handshake()
@ -195,7 +195,7 @@ pub fn client<'t, Stream, Req>(
stream: Stream, stream: Stream,
) -> StdResult<(WebSocket<Stream>, Response), HandshakeError<ClientHandshake<Stream>>> ) -> StdResult<(WebSocket<Stream>, Response), HandshakeError<ClientHandshake<Stream>>>
where where
Stream: Read + Write + Unpin, Stream: Read + Write,
Req: Into<Request<'t>>, Req: Into<Request<'t>>,
{ {
client_with_config(request, stream, None) client_with_config(request, stream, None)

@ -73,7 +73,7 @@ pub struct ClientHandshake<S> {
_marker: PhantomData<S>, _marker: PhantomData<S>,
} }
impl<S: Read + Write + Unpin> ClientHandshake<S> { impl<S: Read + Write> ClientHandshake<S> {
/// Initiate a client handshake. /// Initiate a client handshake.
pub fn start( pub fn start(
stream: S, stream: S,
@ -124,7 +124,7 @@ impl<S: Read + Write + Unpin> ClientHandshake<S> {
} }
} }
impl<S: Read + Write + Unpin> HandshakeRole for ClientHandshake<S> { impl<S: Read + Write> HandshakeRole for ClientHandshake<S> {
type IncomingData = Response; type IncomingData = Response;
type InternalStream = S; type InternalStream = S;
type FinalResult = (WebSocket<S>, Response); type FinalResult = (WebSocket<S>, Response);

@ -101,7 +101,7 @@ pub trait HandshakeRole {
#[doc(hidden)] #[doc(hidden)]
type IncomingData: TryParse; type IncomingData: TryParse;
#[doc(hidden)] #[doc(hidden)]
type InternalStream: Read + Write + Unpin; type InternalStream: Read + Write;
#[doc(hidden)] #[doc(hidden)]
type FinalResult; type FinalResult;
#[doc(hidden)] #[doc(hidden)]

@ -153,7 +153,7 @@ pub struct ServerHandshake<S, C> {
_marker: PhantomData<S>, _marker: PhantomData<S>,
} }
impl<S: Read + Write + Unpin, C: Callback> ServerHandshake<S, C> { impl<S: Read + Write, C: Callback> ServerHandshake<S, C> {
/// Start server handshake. `callback` specifies a custom callback which the user can pass to /// Start server handshake. `callback` specifies a custom callback which the user can pass to
/// the handshake, this callback will be called when the a websocket client connnects to the /// the handshake, this callback will be called when the a websocket client connnects to the
/// server, you can specify the callback if you want to add additional header to the client /// server, you can specify the callback if you want to add additional header to the client
@ -172,7 +172,7 @@ impl<S: Read + Write + Unpin, C: Callback> ServerHandshake<S, C> {
} }
} }
impl<S: Read + Write + Unpin, C: Callback> HandshakeRole for ServerHandshake<S, C> { impl<S: Read + Write, C: Callback> HandshakeRole for ServerHandshake<S, C> {
type IncomingData = Request; type IncomingData = Request;
type InternalStream = S; type InternalStream = S;
type FinalResult = WebSocket<S>; type FinalResult = WebSocket<S>;

@ -18,7 +18,7 @@ use std::io::{Read, Write};
/// If you want TLS support, use `native_tls::TlsStream` or `openssl::ssl::SslStream` /// If you want TLS support, use `native_tls::TlsStream` or `openssl::ssl::SslStream`
/// for the stream here. Any `Read + Write` streams are supported, including /// for the stream here. Any `Read + Write` streams are supported, including
/// those from `Mio` and others. /// those from `Mio` and others.
pub fn accept_with_config<S: Read + Write + Unpin>( pub fn accept_with_config<S: Read + Write>(
stream: S, stream: S,
config: Option<WebSocketConfig>, config: Option<WebSocketConfig>,
) -> Result<WebSocket<S>, HandshakeError<ServerHandshake<S, NoCallback>>> { ) -> Result<WebSocket<S>, HandshakeError<ServerHandshake<S, NoCallback>>> {
@ -31,7 +31,7 @@ pub fn accept_with_config<S: Read + Write + Unpin>(
/// If you want TLS support, use `native_tls::TlsStream` or `openssl::ssl::SslStream` /// If you want TLS support, use `native_tls::TlsStream` or `openssl::ssl::SslStream`
/// for the stream here. Any `Read + Write` streams are supported, including /// for the stream here. Any `Read + Write` streams are supported, including
/// those from `Mio` and others. /// those from `Mio` and others.
pub fn accept<S: Read + Write + Unpin>( pub fn accept<S: Read + Write>(
stream: S, stream: S,
) -> Result<WebSocket<S>, HandshakeError<ServerHandshake<S, NoCallback>>> { ) -> Result<WebSocket<S>, HandshakeError<ServerHandshake<S, NoCallback>>> {
accept_with_config(stream, None) accept_with_config(stream, None)
@ -45,7 +45,7 @@ pub fn accept<S: Read + Write + Unpin>(
/// This function does the same as `accept()` but accepts an extra callback /// This function does the same as `accept()` but accepts an extra callback
/// for header processing. The callback receives headers of the incoming /// for header processing. The callback receives headers of the incoming
/// requests and is able to add extra headers to the reply. /// requests and is able to add extra headers to the reply.
pub fn accept_hdr_with_config<S: Read + Write + Unpin, C: Callback>( pub fn accept_hdr_with_config<S: Read + Write, C: Callback>(
stream: S, stream: S,
callback: C, callback: C,
config: Option<WebSocketConfig>, config: Option<WebSocketConfig>,
@ -58,7 +58,7 @@ pub fn accept_hdr_with_config<S: Read + Write + Unpin, C: Callback>(
/// This function does the same as `accept()` but accepts an extra callback /// This function does the same as `accept()` but accepts an extra callback
/// for header processing. The callback receives headers of the incoming /// for header processing. The callback receives headers of the incoming
/// requests and is able to add extra headers to the reply. /// requests and is able to add extra headers to the reply.
pub fn accept_hdr<S: Read + Write + Unpin, C: Callback>( pub fn accept_hdr<S: Read + Write, C: Callback>(
stream: S, stream: S,
callback: C, callback: C,
) -> Result<WebSocket<S>, HandshakeError<ServerHandshake<S, C>>> { ) -> Result<WebSocket<S>, HandshakeError<ServerHandshake<S, C>>> {

Loading…
Cancel
Save