Skip to content

Commit

Permalink
Apply suggestions to impartial to Gz and MultiGz implementations.
Browse files Browse the repository at this point in the history
I also added a reference to the general section about the differences
in the crate documentation.

Co-Authored-By: Josh Triplett <[email protected]>
  • Loading branch information
Byron and joshtriplett committed Jul 23, 2023
1 parent e21986e commit 1e09571
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
8 changes: 4 additions & 4 deletions src/gz/bufread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,7 @@ impl<R: BufRead + Write> Write for GzEncoder<R> {
}
}

/// A decoder for a single member of a gzip file. Prefer [MultiGzDecoder] for
/// most uses.
/// A decoder for a gzip file with a single member.
///
/// This structure consumes a [`BufRead`] interface, reading compressed data
/// from the underlying reader, and emitting uncompressed data.
Expand Down Expand Up @@ -397,11 +396,12 @@ impl<R: BufRead + Write> Write for GzDecoder<R> {
}
}

/// A gzip streaming decoder that decodes a complete [gzip file].
/// A gzip streaming decoder that decodes a [gzip file] with multiple members.
///
/// A gzip file consists of a series of "members" concatenated one after another.
/// MultiGzDecoder decodes all members of a file, while [GzDecoder] will only decode
/// the first member. MultiGzDecoder is preferable in most cases.
/// the first member. Learn more
/// [in the introduction](https://docs.rs/flate2/*/flate2/#About-multi-member-Gzip-files).
///
/// This structure exposes a [`BufRead`] interface that will consume all gzip members
/// from the underlying reader and emit uncompressed data.
Expand Down
11 changes: 7 additions & 4 deletions src/gz/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,14 @@ impl<R: Read + Write> Write for GzEncoder<R> {
}
}

/// A decoder for a single member of a gzip file. Prefer [MultiGzDecoder] for
/// most uses.
/// A decoder for a gzip file with a single member.
///
/// This structure exposes a [`Read`] interface that will consume compressed
/// data from the underlying reader and emit uncompressed data.
///
/// This decoder only handles gzipped data with a single stream.
/// Use [`MultiGzDecoder`] for gzipped data with multiple streams.
///
/// # Examples
///
/// ```
Expand Down Expand Up @@ -178,11 +180,12 @@ impl<R: Read + Write> Write for GzDecoder<R> {
}
}

/// A gzip streaming decoder that decodes a full [gzip file].
/// A gzip streaming decoder that decodes a [gzip file] with multiple members.
///
/// A gzip file consists of a series of "members" concatenated one after another.
/// MultiGzDecoder decodes all members of a file, while [GzDecoder] will only decode
/// the first member. MultiGzDecoder is preferable in most cases.
/// the first member. Learn more
/// [in the introduction](https://docs.rs/flate2/*/flate2/#About-multi-member-Gzip-files).
///
/// This structure exposes a [`Read`] interface that will consume all gzip members
/// from the underlying reader and emit uncompressed data.
Expand Down
13 changes: 8 additions & 5 deletions src/gz/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,14 @@ impl<W: Write> Drop for GzEncoder<W> {
}
}

/// A decoder for a single member of a gzip file. Prefer [MultiGzDecoder] for
/// most uses.
/// A decoder for a gzip file with a single member.
///
/// This structure exposes a [`Write`] interface that will emit uncompressed data
/// to the underlying writer `W`.
///
/// This decoder only handles gzipped data with a single stream.
/// Use [`MultiGzDecoder`] for gzipped data with multiple streams.
///
/// [`Write`]: https://doc.rust-lang.org/std/io/trait.Write.html
///
/// # Examples
Expand Down Expand Up @@ -373,11 +375,12 @@ impl<W: Read + Write> Read for GzDecoder<W> {
}
}

/// A gzip streaming decoder that decodes a full [gzip file].
/// A gzip streaming decoder that decodes a [gzip file] with multiple members.
///
/// A gzip file consists of a series of "members" concatenated one after another.
/// MultiGzDecoder decodes all members of a file, while [GzDecoder] will only decode
/// the first member. MultiGzDecoder is preferable in most cases.
/// `MultiGzDecoder` decodes all members of a file, while [GzDecoder] will only decode
/// the first member. Learn more
/// [in the introduction](https://docs.rs/flate2/*/flate2/#About-multi-member-Gzip-files).
///
/// This structure exposes a [`Write`] interface that will consume all gzip members
/// from the written buffers and write uncompressed data to the writer.
Expand Down

0 comments on commit 1e09571

Please sign in to comment.