[][src]Struct ws_stream_tungstenite::WsStream

pub struct WsStream<S: AsyncRead01 + AsyncWrite01> { /* fields omitted */ }

Takes a WebSocketStream from tokio-tungstenite and implements futures 0.3 AsyncRead/AsyncWrite. Please look at the documentation of the impls for those traits below for details (rustdoc will collapse them).

Methods

impl<S: AsyncRead01 + AsyncWrite01> WsStream<S>[src]

pub fn new(inner: TTungSocket<S>) -> Self[src]

Create a new WsStream.

Trait Implementations

impl<S: AsyncRead01 + AsyncWrite01> Debug for WsStream<S>[src]

impl<S: AsyncRead01 + AsyncWrite01> AsyncRead for WsStream<S>[src]

When None is returned, it means it is safe to drop the underlying connection.

Errors

impl<S: AsyncRead01 + AsyncWrite01> AsyncWrite for WsStream<S>[src]

Errors

The following errors can be returned when writing to the stream:

  • io::ErrorKind::NotConnected: This means that the connection is already closed. You should drop it. It is safe to drop the underlying connection.

  • io::ErrorKind::InvalidData: This means that a tungstenite::error::Capacity occurred. This means that you send in a buffer bigger than the maximum message size configured on the underlying websocket connection. If you did not set it manually, the default for tungstenite is 64MB.

  • other std::io::Error's generally mean something went wrong on the underlying transport. Consider these fatal and just drop the connection.

fn poll_write(
    self: Pin<&mut Self>,
    cx: &mut Context,
    buf: &[u8]
) -> Poll<Result<usize>>
[src]

Will always flush the underlying socket. Will always create an entire Websocket message from every write, so call with a sufficiently large buffer if you have performance problems.

impl<S> Observable<WsEvent> for WsStream<S> where
    S: AsyncRead01 + AsyncWrite01
[src]

type Error = Error

The error type that is returned if observing is not possible. Read more

Auto Trait Implementations

impl<S> Send for WsStream<S> where
    S: Send

impl<S> Unpin for WsStream<S>

impl<S> !Sync for WsStream<S>

impl<S> !UnwindSafe for WsStream<S>

impl<S> !RefUnwindSafe for WsStream<S>

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<W> AsyncWriteExt for W where
    W: AsyncWrite + ?Sized
[src]

impl<R> AsyncReadExt for R where
    R: AsyncRead + ?Sized
[src]

impl<T> Erased for T

impl<T> Same<T> for T

type Output = T

Should always be Self