[][src]Struct ws_stream_wasm::WsIo

pub struct WsIo { /* fields omitted */ }

A futures 0.3 Sink/Stream of WsMessage. It further implements AsyncRead/AsyncWrite that can be framed with codecs. You can use the compat layer from the futures library if you want to use tokio codecs. See the integration tests if you need an example.

Created with WsStream::connect.

Methods

impl WsIo[src]

pub fn new(ws: Rc<WebSocket>, pharos: Rc<RefCell<Pharos<WsEvent>>>) -> Self[src]

Create a new WsIo.

pub fn ready_state(&self) -> WsState[src]

Verify the WsState of the connection.

pub fn wrapped(&self) -> &WebSocket[src]

Access the wrapped web_sys::WebSocket directly.

ws_stream_wasm tries to expose all useful functionality through an idiomatic rust API, so hopefully you won't need this, however if I missed something, you can.

Caveats

If you call set_onopen, set_onerror, set_onmessage or set_onclose on this, you will overwrite the event listeners from ws_stream_wasm, and things will break.

Trait Implementations

impl Drop for WsIo[src]

impl Debug for WsIo[src]

impl Sink<WsMessage> for WsIo[src]

type Error = WsErr

The type of value produced by the sink when an error occurs.

impl Stream for WsIo[src]

type Item = WsMessage

Values yielded by the stream.

impl AsyncRead for WsIo[src]

impl AsyncWrite for WsIo[src]

Auto Trait Implementations

impl !Send for WsIo

impl Unpin for WsIo

impl !Sync for WsIo

impl !UnwindSafe for WsIo

impl !RefUnwindSafe for WsIo

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<R> AsyncReadExt for R where
    R: AsyncRead + ?Sized
[src]

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

impl<T> StreamExt for T where
    T: Stream + ?Sized
[src]

impl<T, Item> SinkExt<Item> for T where
    T: Sink<Item> + ?Sized
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,