Skip to main content

ReadTimeout

Trait ReadTimeout 

Source
pub trait ReadTimeout {
    // Required method
    fn set_read_timeout(&self, timeout: Option<Duration>) -> Result<()>;
}
Expand description

A blocking transport whose reads can be bounded in time, as the _until loops need to end at their deadline.

Implemented for TcpStream and &TcpStream (a socket shared with another thread, which may shut it down). A transport that cannot time out implements it as a no-op; a loop over it then checks its deadline only between reads, and a read that never returns holds it past the deadline.

Required Methods§

Source

fn set_read_timeout(&self, timeout: Option<Duration>) -> Result<()>

Sets the timeout of every read from now on; None waits forever.

§Errors

When the transport refuses the setting.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl ReadTimeout for &TcpStream

Source§

impl ReadTimeout for TcpStream

Implementors§