Struct async_io_stream::IoStream[][src]

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

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.

Implementations

Create a new IoStream.

Get a reference to the inner stream.

Get a mut reference to the inner stream.

Trait Implementations

Attempt to return the contents of the internal buffer, filling it with more data from the inner reader if it is empty. Read more

Tells this buffer that amt bytes have been consumed from the buffer, so they should no longer be returned in calls to poll_read. Read more

Attempt to read from the AsyncRead into buf. Read more

Attempt to read from the AsyncRead into bufs using vectored IO operations. Read more

This impl requires the tokio_io feature.

Attempts to read from the AsyncRead into buf. Read more

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.

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.

Attempt to write bytes from bufs into the object using vectored IO operations. Read more

Attempt to flush the object, ensuring that any buffered data reach their destination. Read more

Attempt to close the object. Read more

Attempt to write bytes from buf into the object. Read more

Attempts to flush the object, ensuring that any buffered data reach their destination. Read more

Initiates or attempts to shut down this writer, returning success when the I/O connection has completely shut down. Read more

Like poll_write, except that it writes from a slice of buffers. Read more

Determines if this writer has an efficient poll_write_vectored implementation. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Formats the value using the given formatter. Read more

This impl requires the map_pharos feature.

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

Add an observer to the observable. Options allow chosing the channel type and to filter events with a predicate. Read more

This impl requires the map_pharos feature.

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

Add an observer to the observable. Options allow chosing the channel type and to filter events with a predicate. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Creates a future which will wait for a non-empty buffer to be available from this I/O object or EOF to be reached. Read more

A convenience for calling [AsyncBufRead::consume] on Unpin IO types. Read more

Creates a future which will read all the bytes associated with this I/O object into buf until the delimiter byte or EOF is reached. This method is the async equivalent to BufRead::read_until. Read more

Creates a future which will read all the bytes associated with this I/O object into buf until a newline (the 0xA byte) or EOF is reached, This method is the async equivalent to BufRead::read_line. Read more

Returns a stream over the lines of this reader. This method is the async equivalent to BufRead::lines. Read more

Creates an adaptor which will chain this stream with another. Read more

Tries to read some bytes directly into the given buf in asynchronous manner, returning a future type. Read more

Creates a future which will read from the AsyncRead into bufs using vectored IO operations. Read more

Creates a future which will read exactly enough bytes to fill buf, returning an error if end of file (EOF) is hit sooner. Read more

Creates a future which will read all the bytes from this AsyncRead. Read more

Creates a future which will read all the bytes from this AsyncRead. Read more

Helper method for splitting this read/write object into two halves. Read more

Creates an AsyncRead adapter which will read at most limit bytes from the underlying reader. Read more

Creates a future which will entirely flush this AsyncWrite. Read more

Creates a future which will entirely close this AsyncWrite.

Creates a future which will write bytes from buf into the object. Read more

Creates a future which will write bytes from bufs into the object using vectored IO operations. Read more

Write data into this object. Read more

This is supported on crate feature sink only.

Allow using an [AsyncWrite] as a Sink<Item: AsRef<[u8]>>. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.