[−][src]Struct async_io_stream::IoStream
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]
St: Unpin,
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]
St: TryStream<Ok = I, Error = Error> + Unpin,
I: AsRef<[u8]> + Unpin,
fn poll_fill_buf(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Result<&[u8]>>
[src]
fn consume(self: Pin<&mut Self>, amount: usize)
[src]
impl<St, I> AsyncRead for IoStream<St, I> where
St: TryStream<Ok = I, Error = Error> + Unpin,
I: AsRef<[u8]>,
[src]
St: TryStream<Ok = I, Error = Error> + Unpin,
I: AsRef<[u8]>,
fn poll_read(
self: Pin<&mut Self>,
cx: &mut Context,
buf: &mut [u8]
) -> Poll<Result<usize>>
[src]
self: Pin<&mut Self>,
cx: &mut Context,
buf: &mut [u8]
) -> Poll<Result<usize>>
fn poll_read_vectored(
self: Pin<&mut Self>,
cx: &mut Context,
bufs: &mut [IoSliceMut]
) -> Poll<Result<usize>>
[src]
self: Pin<&mut Self>,
cx: &mut Context,
bufs: &mut [IoSliceMut]
) -> Poll<Result<usize>>
impl<St, I> AsyncRead for IoStream<St, I> where
St: TryStream<Ok = I, Error = Error> + Unpin,
I: AsRef<[u8]>,
[src]
St: TryStream<Ok = I, Error = Error> + Unpin,
I: AsRef<[u8]>,
fn poll_read(
self: Pin<&mut Self>,
cx: &mut Context,
buf: &mut [u8]
) -> Poll<Result<usize>>
[src]
self: Pin<&mut Self>,
cx: &mut Context,
buf: &mut [u8]
) -> Poll<Result<usize>>
unsafe fn prepare_uninitialized_buffer(
&self,
buf: &mut [MaybeUninit<u8>]
) -> bool
[src]
&self,
buf: &mut [MaybeUninit<u8>]
) -> bool
fn poll_read_buf<B>(
self: Pin<&mut Self>,
cx: &mut Context,
buf: &mut B
) -> Poll<Result<usize, Error>> where
B: BufMut,
[src]
self: Pin<&mut Self>,
cx: &mut Context,
buf: &mut B
) -> Poll<Result<usize, Error>> where
B: BufMut,
impl<St, I> AsyncWrite for IoStream<St, I> where
St: Sink<I, Error = Error> + Unpin,
I: From<Vec<u8>>,
[src]
St: Sink<I, Error = Error> + Unpin,
I: From<Vec<u8>>,
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]
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.
fn poll_write_vectored(
self: Pin<&mut Self>,
cx: &mut Context,
bufs: &[IoSlice]
) -> Poll<Result<usize>>
[src]
self: Pin<&mut Self>,
cx: &mut Context,
bufs: &[IoSlice]
) -> Poll<Result<usize>>
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Result<()>>
[src]
fn poll_close(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Result<()>>
[src]
impl<St, I> AsyncWrite for IoStream<St, I> where
St: Sink<I, Error = Error> + Unpin,
I: From<Vec<u8>>,
[src]
St: Sink<I, Error = Error> + Unpin,
I: From<Vec<u8>>,
fn poll_write(
self: Pin<&mut Self>,
cx: &mut Context,
buf: &[u8]
) -> Poll<Result<usize>>
[src]
self: Pin<&mut Self>,
cx: &mut Context,
buf: &[u8]
) -> Poll<Result<usize>>
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Result<()>>
[src]
fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Result<()>>
[src]
fn poll_write_buf<B>(
self: Pin<&mut Self>,
cx: &mut Context,
buf: &mut B
) -> Poll<Result<usize, Error>> where
B: Buf,
[src]
self: Pin<&mut Self>,
cx: &mut Context,
buf: &mut B
) -> Poll<Result<usize, Error>> where
B: Buf,
impl<St, I> Borrow<St> for IoStream<St, I> where
St: Sink<I, Error = Error> + TryStream<Ok = I, Error = Error> + Unpin,
[src]
St: Sink<I, Error = Error> + TryStream<Ok = I, Error = Error> + Unpin,
impl<St, I> BorrowMut<St> for IoStream<St, I> where
St: Sink<I, Error = Error> + TryStream<Ok = I, Error = Error> + Unpin,
[src]
St: Sink<I, Error = Error> + TryStream<Ok = I, Error = Error> + Unpin,
fn borrow_mut(&mut self) -> &mut St
[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]
St: Sink<I, Error = Error> + TryStream<Ok = I, Error = Error> + Observable<Ev> + Unpin,
Ev: Clone + Send + 'static,
type Error = <St as Observable<Ev>>::Error
The error type that is returned if observing is not possible. Read more
fn observe(
&mut self,
options: ObserveConfig<Ev>
) -> Result<Events<Ev>, Self::Error>
[src]
&mut self,
options: ObserveConfig<Ev>
) -> Result<Events<Ev>, Self::Error>
impl<St, I> Unpin for IoStream<St, I> where
St: Unpin,
[src]
St: Unpin,
Auto Trait Implementations
impl<St, I> !RefUnwindSafe for IoStream<St, I>
impl<St, I> Send for IoStream<St, I> where
I: Send,
St: Send,
I: Send,
St: Send,
impl<St, I> Sync for IoStream<St, I> where
I: Sync,
St: Sync,
I: Sync,
St: Sync,
impl<St, I> !UnwindSafe for IoStream<St, I>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<R> AsyncBufReadExt for R where
R: AsyncBufRead + ?Sized,
[src]
R: AsyncBufRead + ?Sized,
fn read_until(
&'a mut self,
byte: u8,
buf: &'a mut Vec<u8>
) -> ReadUntil<'a, Self> where
Self: Unpin,
[src]
&'a mut self,
byte: u8,
buf: &'a mut Vec<u8>
) -> ReadUntil<'a, Self> where
Self: Unpin,
fn read_line(&'a mut self, buf: &'a mut String) -> ReadLine<'a, Self> where
Self: Unpin,
[src]
Self: Unpin,
fn lines(self) -> Lines<Self>
[src]
impl<R> AsyncReadExt for R where
R: AsyncRead + ?Sized,
[src]
R: AsyncRead + ?Sized,
fn chain<R>(self, next: R) -> Chain<Self, R> where
R: AsyncRead,
[src]
R: AsyncRead,
fn read(&'a mut self, buf: &'a mut [u8]) -> Read<'a, Self> where
Self: Unpin,
[src]
Self: Unpin,
fn read_vectored(
&'a mut self,
bufs: &'a mut [IoSliceMut<'a>]
) -> ReadVectored<'a, Self> where
Self: Unpin,
[src]
&'a mut self,
bufs: &'a mut [IoSliceMut<'a>]
) -> ReadVectored<'a, Self> where
Self: Unpin,
fn read_exact(&'a mut self, buf: &'a mut [u8]) -> ReadExact<'a, Self> where
Self: Unpin,
[src]
Self: Unpin,
fn read_to_end(&'a mut self, buf: &'a mut Vec<u8>) -> ReadToEnd<'a, Self> where
Self: Unpin,
[src]
Self: Unpin,
fn read_to_string(&'a mut self, buf: &'a mut String) -> ReadToString<'a, Self> where
Self: Unpin,
[src]
Self: Unpin,
fn split(self) -> (ReadHalf<Self>, WriteHalf<Self>) where
Self: AsyncWrite,
[src]
Self: AsyncWrite,
fn take(self, limit: u64) -> Take<Self>
[src]
impl<W> AsyncWriteExt for W where
W: AsyncWrite + ?Sized,
[src]
W: AsyncWrite + ?Sized,
fn flush(&mut self) -> Flush<Self> where
Self: Unpin,
[src]
Self: Unpin,
fn close(&mut self) -> Close<Self> where
Self: Unpin,
[src]
Self: Unpin,
fn write(&'a mut self, buf: &'a [u8]) -> Write<'a, Self> where
Self: Unpin,
[src]
Self: Unpin,
fn write_vectored(
&'a mut self,
bufs: &'a [IoSlice<'a>]
) -> WriteVectored<'a, Self> where
Self: Unpin,
[src]
&'a mut self,
bufs: &'a [IoSlice<'a>]
) -> WriteVectored<'a, Self> where
Self: Unpin,
fn write_all(&'a mut self, buf: &'a [u8]) -> WriteAll<'a, Self> where
Self: Unpin,
[src]
Self: Unpin,
fn into_sink<Item>(self) -> IntoSink<Self, Item> where
Item: AsRef<[u8]>,
[src]
Item: AsRef<[u8]>,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,