Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReadBytesExt: document the danger of reading after an error #209

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ pub trait ReadBytesExt: io::Read {
///
/// This method returns the same errors as [`Read::read_exact`].
///
/// If an error is returned, the reader will be left in an unspecified
/// state, and should not be used for additional reads.
///
/// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
///
/// # Examples
Expand Down Expand Up @@ -67,6 +70,9 @@ pub trait ReadBytesExt: io::Read {
///
/// This method returns the same errors as [`Read::read_exact`].
///
/// If an error is returned, the reader will be left in an unspecified
/// state, and should not be used for additional reads.
///
/// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
///
/// # Examples
Expand Down Expand Up @@ -94,6 +100,9 @@ pub trait ReadBytesExt: io::Read {
///
/// This method returns the same errors as [`Read::read_exact`].
///
/// If an error is returned, the reader will be left in an unspecified
/// state, and should not be used for additional reads.
///
/// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
///
/// # Examples
Expand Down Expand Up @@ -121,6 +130,9 @@ pub trait ReadBytesExt: io::Read {
///
/// This method returns the same errors as [`Read::read_exact`].
///
/// If an error is returned, the reader will be left in an unspecified
/// state, and should not be used for additional reads.
///
/// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
///
/// # Examples
Expand Down Expand Up @@ -148,6 +160,9 @@ pub trait ReadBytesExt: io::Read {
///
/// This method returns the same errors as [`Read::read_exact`].
///
/// If an error is returned, the reader will be left in an unspecified
/// state, and should not be used for additional reads.
///
/// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
///
/// # Examples
Expand All @@ -174,6 +189,9 @@ pub trait ReadBytesExt: io::Read {
///
/// This method returns the same errors as [`Read::read_exact`].
///
/// If an error is returned, the reader will be left in an unspecified
/// state, and should not be used for additional reads.
///
/// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
///
/// # Examples
Expand All @@ -200,6 +218,9 @@ pub trait ReadBytesExt: io::Read {
///
/// This method returns the same errors as [`Read::read_exact`].
///
/// If an error is returned, the reader will be left in an unspecified
/// state, and should not be used for additional reads.
///
/// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
///
/// # Examples
Expand All @@ -226,6 +247,9 @@ pub trait ReadBytesExt: io::Read {
///
/// This method returns the same errors as [`Read::read_exact`].
///
/// If an error is returned, the reader will be left in an unspecified
/// state, and should not be used for additional reads.
///
/// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
///
/// # Examples
Expand All @@ -252,6 +276,9 @@ pub trait ReadBytesExt: io::Read {
///
/// This method returns the same errors as [`Read::read_exact`].
///
/// If an error is returned, the reader will be left in an unspecified
/// state, and should not be used for additional reads.
///
/// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
///
/// # Examples
Expand All @@ -278,6 +305,9 @@ pub trait ReadBytesExt: io::Read {
///
/// This method returns the same errors as [`Read::read_exact`].
///
/// If an error is returned, the reader will be left in an unspecified
/// state, and should not be used for additional reads.
///
/// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
///
/// # Examples
Expand All @@ -304,6 +334,9 @@ pub trait ReadBytesExt: io::Read {
///
/// This method returns the same errors as [`Read::read_exact`].
///
/// If an error is returned, the reader will be left in an unspecified
/// state, and should not be used for additional reads.
///
/// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
///
/// # Examples
Expand All @@ -330,6 +363,9 @@ pub trait ReadBytesExt: io::Read {
///
/// This method returns the same errors as [`Read::read_exact`].
///
/// If an error is returned, the reader will be left in an unspecified
/// state, and should not be used for additional reads.
///
/// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
///
/// # Examples
Expand All @@ -356,6 +392,9 @@ pub trait ReadBytesExt: io::Read {
///
/// This method returns the same errors as [`Read::read_exact`].
///
/// If an error is returned, the reader will be left in an unspecified
/// state, and should not be used for additional reads.
///
/// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
///
/// # Examples
Expand Down Expand Up @@ -385,6 +424,9 @@ pub trait ReadBytesExt: io::Read {
///
/// This method returns the same errors as [`Read::read_exact`].
///
/// If an error is returned, the reader will be left in an unspecified
/// state, and should not be used for additional reads.
///
/// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
///
/// # Examples
Expand All @@ -411,6 +453,9 @@ pub trait ReadBytesExt: io::Read {
///
/// This method returns the same errors as [`Read::read_exact`].
///
/// If an error is returned, the reader will be left in an unspecified
/// state, and should not be used for additional reads.
///
/// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
///
/// # Examples
Expand All @@ -436,6 +481,9 @@ pub trait ReadBytesExt: io::Read {
///
/// This method returns the same errors as [`Read::read_exact`].
///
/// If an error is returned, the reader will be left in an unspecified
/// state, and should not be used for additional reads.
///
/// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
///
/// # Examples
Expand Down Expand Up @@ -478,6 +526,9 @@ pub trait ReadBytesExt: io::Read {
///
/// This method returns the same errors as [`Read::read_exact`].
///
/// If an error is returned, the reader will be left in an unspecified
/// state, and should not be used for additional reads.
///
/// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
///
/// # Examples
Expand Down Expand Up @@ -509,6 +560,9 @@ pub trait ReadBytesExt: io::Read {
///
/// This method returns the same errors as [`Read::read_exact`].
///
/// If an error is returned, the reader will be left in an unspecified
/// state, and should not be used for additional reads.
///
/// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
///
/// # Examples
Expand Down Expand Up @@ -543,6 +597,9 @@ pub trait ReadBytesExt: io::Read {
///
/// This method returns the same errors as [`Read::read_exact`].
///
/// If an error is returned, the reader will be left in an unspecified
/// state, and should not be used for additional reads.
///
/// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
///
/// # Examples
Expand Down Expand Up @@ -578,6 +635,9 @@ pub trait ReadBytesExt: io::Read {
///
/// This method returns the same errors as [`Read::read_exact`].
///
/// If an error is returned, the reader will be left in an unspecified
/// state, and should not be used for additional reads.
///
/// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
///
/// # Examples
Expand Down Expand Up @@ -613,6 +673,9 @@ pub trait ReadBytesExt: io::Read {
///
/// This method returns the same errors as [`Read::read_exact`].
///
/// If an error is returned, the reader will be left in an unspecified
/// state, and should not be used for additional reads.
///
/// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
///
/// # Examples
Expand Down Expand Up @@ -651,6 +714,9 @@ pub trait ReadBytesExt: io::Read {
///
/// This method returns the same errors as [`Read::read_exact`].
///
/// If an error is returned, the reader will be left in an unspecified
/// state, and should not be used for additional reads.
///
/// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
///
/// # Examples
Expand Down Expand Up @@ -697,6 +763,9 @@ pub trait ReadBytesExt: io::Read {
///
/// This method returns the same errors as [`Read::read_exact`].
///
/// If an error is returned, the reader will be left in an unspecified
/// state, and should not be used for additional reads.
///
/// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
///
/// # Examples
Expand Down Expand Up @@ -728,6 +797,9 @@ pub trait ReadBytesExt: io::Read {
///
/// This method returns the same errors as [`Read::read_exact`].
///
/// If an error is returned, the reader will be left in an unspecified
/// state, and should not be used for additional reads.
///
/// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
///
/// # Examples
Expand Down Expand Up @@ -763,6 +835,9 @@ pub trait ReadBytesExt: io::Read {
///
/// This method returns the same errors as [`Read::read_exact`].
///
/// If an error is returned, the reader will be left in an unspecified
/// state, and should not be used for additional reads.
///
/// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
///
/// # Examples
Expand Down Expand Up @@ -798,6 +873,9 @@ pub trait ReadBytesExt: io::Read {
///
/// This method returns the same errors as [`Read::read_exact`].
///
/// If an error is returned, the reader will be left in an unspecified
/// state, and should not be used for additional reads.
///
/// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
///
/// # Examples
Expand Down Expand Up @@ -836,6 +914,9 @@ pub trait ReadBytesExt: io::Read {
///
/// This method returns the same errors as [`Read::read_exact`].
///
/// If an error is returned, the reader will be left in an unspecified
/// state, and should not be used for additional reads.
///
/// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
///
/// # Examples
Expand Down Expand Up @@ -877,6 +958,9 @@ pub trait ReadBytesExt: io::Read {
///
/// This method returns the same errors as [`Read::read_exact`].
///
/// If an error is returned, the reader will be left in an unspecified
/// state, and should not be used for additional reads.
///
/// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
///
/// # Examples
Expand Down Expand Up @@ -922,6 +1006,9 @@ pub trait ReadBytesExt: io::Read {
///
/// This method returns the same errors as [`Read::read_exact`].
///
/// If an error is returned, the reader will be left in an unspecified
/// state, and should not be used for additional reads.
///
/// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
///
/// # Examples
Expand Down Expand Up @@ -962,6 +1049,9 @@ pub trait ReadBytesExt: io::Read {
///
/// This method returns the same errors as [`Read::read_exact`].
///
/// If an error is returned, the reader will be left in an unspecified
/// state, and should not be used for additional reads.
///
/// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
///
/// # Examples
Expand Down Expand Up @@ -1013,6 +1103,9 @@ pub trait ReadBytesExt: io::Read {
///
/// This method returns the same errors as [`Read::read_exact`].
///
/// If an error is returned, the reader will be left in an unspecified
/// state, and should not be used for additional reads.
///
/// [`Read::read_exact`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_exact
///
/// # Examples
Expand Down