[][src]Struct async_io_stream::IoStream

pub struct IoStream<St, I> where
    St: Unpin
{ /* fields omitted */ }

A wrapper over a TryStream + Sink that implements AsyncRead/AsyncWrite and AsyncBufRead. See the readme for more information.

Implements tokio::io::AsyncRead and tokio::io::AsyncWrite when the tokio_io feature is enabled.

Methods

impl<St, I> IoStream<St, I> where
    St: Unpin
[src]

pub fn new(inner: St) -> Self[src]

Create a new IoStream.

pub fn inner(&self) -> &St[src]

Get a reference to the inner stream.

pub fn inner_mut(&mut self) -> &mut St[src]

Get a mut reference to the inner stream.

Trait Implementations

impl<St, I> AsyncBufRead for IoStream<St, I> where
    St: TryStream<Ok = I, Error = Error> + Unpin,
    I: AsRef<[u8]> + Unpin
[src]

impl<St, I> AsyncRead for IoStream<St, I> where
    St: TryStream<Ok = I, Error = Error> + Unpin,
    I: AsRef<[u8]>, 
[src]

impl<St, I> AsyncRead for IoStream<St, I> where
    St: TryStream<Ok = I, Error = Error> + Unpin,
    I: AsRef<[u8]>, 
[src]

impl<St, I> AsyncWrite for IoStream<St, I> where
    St: Sink<I, Error = Error> + Unpin,
    I: From<Vec<u8>>, 
[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<St, I> AsyncWrite for IoStream<St, I> where
    St: Sink<I, Error = Error> + Unpin,
    I: From<Vec<u8>>, 
[src]

impl<St, I> Borrow<St> for IoStream<St, I> where
    St: Sink<I, Error = Error> + TryStream<Ok = I, Error = Error> + Unpin
[src]

impl<St, I> BorrowMut<St> for IoStream<St, I> where
    St: Sink<I, Error = Error> + TryStream<Ok = I, Error = Error> + Unpin
[src]

impl<St: Unpin, I> Debug for IoStream<St, I>[src]

impl<St, I, Ev> Observable<Ev> for IoStream<St, I> where
    St: Sink<I, Error = Error> + TryStream<Ok = I, Error = Error> + Observable<Ev> + Unpin,
    Ev: Clone + Send + 'static, 
[src]

type Error = <St as Observable<Ev>>::Error

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

impl<St, I> Unpin for IoStream<St, I> where
    St: Unpin
[src]

Auto Trait Implementations

impl<St, I> !RefUnwindSafe for IoStream<St, I>

impl<St, I> Send for IoStream<St, I> where
    I: Send,
    St: Send

impl<St, I> Sync for IoStream<St, I> where
    I: Sync,
    St: Sync

impl<St, I> !UnwindSafe for IoStream<St, I>

Blanket Implementations

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

impl<R> AsyncBufReadExt for R where
    R: AsyncBufRead + ?Sized
[src]

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

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

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

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

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

impl<T, U> Into<U> for T where
    U: From<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.