pub struct Reader<'a> { /* private fields */ }
Expand description

A structure that implements std::io::Read for reading plaintext.

Trait Implementations

Obtain plaintext data received from the peer over this TLS connection.

If the peer closes the TLS session cleanly, this returns Ok(0) once all the pending data has been read. No further data can be received on that connection, so the underlying TCP connection should be half-closed too.

If the peer closes the TLS session uncleanly (a TCP EOF without sending a close_notify alert) this function returns Err(ErrorKind::UnexpectedEof.into()) once any pending data has been read.

Note that support for close_notify varies in peer TLS libraries: many do not support it and uncleanly close the TCP connection (this might be vulnerable to truncation attacks depending on the application protocol). This means applications using rustls must both handle EOF from this function, and unexpected EOF of the underlying TCP connection.

If there are no bytes to read, this returns Err(ErrorKind::WouldBlock.into()).

You may learn the number of bytes available at any time by inspecting the return of Connection::process_new_packets.

Like read, except that it reads into a slice of buffers. Read more

🔬 This is a nightly-only experimental API. (can_vector)

Determines if this Reader has an efficient read_vectored implementation. Read more

Read all bytes until EOF in this source, placing them into buf. Read more

Read all bytes until EOF in this source, appending them to buf. Read more

Read the exact number of bytes required to fill buf. Read more

🔬 This is a nightly-only experimental API. (read_buf)

Pull some bytes from this source into the specified buffer. Read more

🔬 This is a nightly-only experimental API. (read_buf)

Read the exact number of bytes required to fill buf. Read more

Creates a “by reference” adaptor for this instance of Read. Read more

Transforms this Read instance to an Iterator over its bytes. Read more

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

Creates an adapter which will read at most limit bytes from it. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.