pub struct IoStream<St, I>where
St: Unpin,{ /* private fields */ }
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§
Trait Implementations§
Source§impl<St, I> AsyncBufRead for IoStream<St, I>
impl<St, I> AsyncBufRead for IoStream<St, I>
Source§impl<St, I> AsyncRead for IoStream<St, I>
impl<St, I> AsyncRead for IoStream<St, I>
Source§impl<St, I> AsyncRead for IoStream<St, I>
Available on crate feature tokio_io
only.This impl requires the tokio_io
feature.
impl<St, I> AsyncRead for IoStream<St, I>
tokio_io
only.This impl requires the tokio_io
feature.
Source§impl<St, I> AsyncWrite for IoStream<St, I>
§Errors
The following errors can be returned when writing to the stream:
impl<St, I> AsyncWrite for IoStream<St, I>
§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.
Source§fn poll_write(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &[u8],
) -> Poll<Result<usize>>
fn poll_write( self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8], ) -> Poll<Result<usize>>
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.
Source§fn poll_write_vectored(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
bufs: &[IoSlice<'_>],
) -> Poll<Result<usize>>
fn poll_write_vectored( self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &[IoSlice<'_>], ) -> Poll<Result<usize>>
bufs
into the object using vectored
IO operations. Read moreSource§impl<St, I> AsyncWrite for IoStream<St, I>
Available on crate feature tokio_io
only.
impl<St, I> AsyncWrite for IoStream<St, I>
tokio_io
only.Source§fn poll_write(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &[u8],
) -> Poll<Result<usize>>
fn poll_write( self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8], ) -> Poll<Result<usize>>
buf
into the object. Read moreSource§fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
Source§fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
Source§fn poll_write_vectored(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
bufs: &[IoSlice<'_>],
) -> Poll<Result<usize, Error>>
fn poll_write_vectored( self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &[IoSlice<'_>], ) -> Poll<Result<usize, Error>>
poll_write
, except that it writes from a slice of buffers. Read moreSource§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
poll_write_vectored
implementation. Read moreSource§impl<St, I> BorrowMut<St> for IoStream<St, I>
impl<St, I> BorrowMut<St> for IoStream<St, I>
Source§fn borrow_mut(&mut self) -> &mut St
fn borrow_mut(&mut self) -> &mut St
Source§impl<St, I, Ev> Observable<Ev> for IoStream<St, I>
Available on crate feature map_pharos
only.This impl requires the map_pharos
feature.
impl<St, I, Ev> Observable<Ev> for IoStream<St, I>
map_pharos
only.This impl requires the map_pharos
feature.
Source§impl<St, I, Ev> ObservableLocal<Ev> for IoStream<St, I>
Available on crate feature map_pharos
only.This impl requires the map_pharos
feature.
impl<St, I, Ev> ObservableLocal<Ev> for IoStream<St, I>
map_pharos
only.This impl requires the map_pharos
feature.
Source§type Error = <St as ObservableLocal<Ev>>::Error
type Error = <St as ObservableLocal<Ev>>::Error
Source§fn observe_local(
&mut self,
options: ObserveConfig<Ev>,
) -> ObserveLocal<'_, Ev, Self::Error>
fn observe_local( &mut self, options: ObserveConfig<Ev>, ) -> ObserveLocal<'_, Ev, Self::Error>
impl<St, I> Unpin for IoStream<St, I>where
St: Unpin,
Auto Trait Implementations§
impl<St, I> Freeze for IoStream<St, I>
impl<St, I> !RefUnwindSafe for IoStream<St, I>
impl<St, I> Send for IoStream<St, I>
impl<St, I> Sync for IoStream<St, I>
impl<St, I> !UnwindSafe for IoStream<St, I>
Blanket Implementations§
Source§impl<R> AsyncBufReadExt for Rwhere
R: AsyncBufRead + ?Sized,
impl<R> AsyncBufReadExt for Rwhere
R: AsyncBufRead + ?Sized,
Source§fn fill_buf(&mut self) -> FillBuf<'_, Self>where
Self: Unpin,
fn fill_buf(&mut self) -> FillBuf<'_, Self>where
Self: Unpin,
Source§fn consume_unpin(&mut self, amt: usize)where
Self: Unpin,
fn consume_unpin(&mut self, amt: usize)where
Self: Unpin,
Source§fn read_until<'a>(
&'a mut self,
byte: u8,
buf: &'a mut Vec<u8>,
) -> ReadUntil<'a, Self>where
Self: Unpin,
fn read_until<'a>(
&'a mut self,
byte: u8,
buf: &'a mut Vec<u8>,
) -> ReadUntil<'a, Self>where
Self: Unpin,
buf
until the delimiter byte
or EOF is reached.
This method is the async equivalent to BufRead::read_until
. Read moreSource§fn read_line<'a>(&'a mut self, buf: &'a mut String) -> ReadLine<'a, Self>where
Self: Unpin,
fn read_line<'a>(&'a mut self, buf: &'a mut String) -> ReadLine<'a, Self>where
Self: Unpin,
buf
until a newline (the 0xA byte) or EOF is reached,
This method is the async equivalent to BufRead::read_line
. Read moreSource§impl<R> AsyncReadExt for R
impl<R> AsyncReadExt for R
Source§fn chain<R>(self, next: R) -> Chain<Self, R>
fn chain<R>(self, next: R) -> Chain<Self, R>
Source§fn read<'a>(&'a mut self, buf: &'a mut [u8]) -> Read<'a, Self>where
Self: Unpin,
fn read<'a>(&'a mut self, buf: &'a mut [u8]) -> Read<'a, Self>where
Self: Unpin,
buf
in asynchronous
manner, returning a future type. Read moreSource§fn read_vectored<'a>(
&'a mut self,
bufs: &'a mut [IoSliceMut<'a>],
) -> ReadVectored<'a, Self>where
Self: Unpin,
fn read_vectored<'a>(
&'a mut self,
bufs: &'a mut [IoSliceMut<'a>],
) -> ReadVectored<'a, Self>where
Self: Unpin,
AsyncRead
into bufs
using vectored
IO operations. Read moreSource§fn read_exact<'a>(&'a mut self, buf: &'a mut [u8]) -> ReadExact<'a, Self>where
Self: Unpin,
fn read_exact<'a>(&'a mut self, buf: &'a mut [u8]) -> ReadExact<'a, Self>where
Self: Unpin,
buf
,
returning an error if end of file (EOF) is hit sooner. Read moreSource§fn read_to_end<'a>(&'a mut self, buf: &'a mut Vec<u8>) -> ReadToEnd<'a, Self>where
Self: Unpin,
fn read_to_end<'a>(&'a mut self, buf: &'a mut Vec<u8>) -> ReadToEnd<'a, Self>where
Self: Unpin,
AsyncRead
. Read moreSource§fn read_to_string<'a>(
&'a mut self,
buf: &'a mut String,
) -> ReadToString<'a, Self>where
Self: Unpin,
fn read_to_string<'a>(
&'a mut self,
buf: &'a mut String,
) -> ReadToString<'a, Self>where
Self: Unpin,
AsyncRead
. Read moreSource§impl<W> AsyncWriteExt for Wwhere
W: AsyncWrite + ?Sized,
impl<W> AsyncWriteExt for Wwhere
W: AsyncWrite + ?Sized,
Source§fn flush(&mut self) -> Flush<'_, Self>where
Self: Unpin,
fn flush(&mut self) -> Flush<'_, Self>where
Self: Unpin,
AsyncWrite
. Read moreSource§fn close(&mut self) -> Close<'_, Self>where
Self: Unpin,
fn close(&mut self) -> Close<'_, Self>where
Self: Unpin,
AsyncWrite
.Source§fn write<'a>(&'a mut self, buf: &'a [u8]) -> Write<'a, Self>where
Self: Unpin,
fn write<'a>(&'a mut self, buf: &'a [u8]) -> Write<'a, Self>where
Self: Unpin,
buf
into the object. Read moreSource§fn write_vectored<'a>(
&'a mut self,
bufs: &'a [IoSlice<'a>],
) -> WriteVectored<'a, Self>where
Self: Unpin,
fn write_vectored<'a>(
&'a mut self,
bufs: &'a [IoSlice<'a>],
) -> WriteVectored<'a, Self>where
Self: Unpin,
bufs
into the object using vectored
IO operations. Read more