[][src]Struct tokio_io_timeout::TimeoutStream

pub struct TimeoutStream<S> { /* fields omitted */ }

A stream which applies read and write timeouts to an inner stream.

Implementations

impl<S> TimeoutStream<S> where
    S: AsyncRead + AsyncWrite
[src]

pub fn new(stream: S) -> TimeoutStream<S>[src]

Returns a new TimeoutStream wrapping the specified stream.

There is initially no read or write timeout.

pub fn read_timeout(&self) -> Option<Duration>[src]

Returns the current read timeout.

pub fn set_read_timeout(&mut self, timeout: Option<Duration>)[src]

Sets the read timeout.

This can only be used before the stream is pinned; use set_read_timeout_pinned otherwise.

pub fn set_read_timeout_pinned(self: Pin<&mut Self>, timeout: Option<Duration>)[src]

Sets the read timeout.

This will reset any pending read timeout. Use set_read_timeout instead if the stream has not yet been pinned.

pub fn write_timeout(&self) -> Option<Duration>[src]

Returns the current write timeout.

pub fn set_write_timeout(&mut self, timeout: Option<Duration>)[src]

Sets the write timeout.

This can only be used before the stream is pinned; use set_write_timeout_pinned otherwise.

pub fn set_write_timeout_pinned(self: Pin<&mut Self>, timeout: Option<Duration>)[src]

Sets the write timeout.

This will reset any pending write timeout. Use set_write_timeout instead if the stream has not yet been pinned.

pub fn get_ref(&self) -> &S[src]

Returns a shared reference to the inner stream.

pub fn get_mut(&mut self) -> &mut S[src]

Returns a mutable reference to the inner stream.

pub fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut S>[src]

Returns a pinned mutable reference to the inner stream.

pub fn into_inner(self) -> S[src]

Consumes the stream, returning the inner stream.

Trait Implementations

impl<S> AsyncRead for TimeoutStream<S> where
    S: AsyncRead + AsyncWrite
[src]

impl<S> AsyncWrite for TimeoutStream<S> where
    S: AsyncRead + AsyncWrite
[src]

impl<S: Debug> Debug for TimeoutStream<S>[src]

impl<'__pin, S> Unpin for TimeoutStream<S> where
    __Origin<'__pin, S>: Unpin
[src]

Auto Trait Implementations

impl<S> !RefUnwindSafe for TimeoutStream<S>[src]

impl<S> Send for TimeoutStream<S> where
    S: Send
[src]

impl<S> Sync for TimeoutStream<S> where
    S: Sync
[src]

impl<S> !UnwindSafe for TimeoutStream<S>[src]

Blanket Implementations

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> 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.