Skip to content

Commit

Permalink
Recommend MultiGzDecoder over GzDecoder in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jsha committed Oct 31, 2022
1 parent 3b2c3a1 commit 70c30e6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
14 changes: 6 additions & 8 deletions src/gz/bufread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,8 @@ impl<R: BufRead + Write> Write for GzEncoder<R> {
}
}

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

/// A gzip streaming decoder that decodes all members of a multistream
/// A gzip streaming decoder that decodes a full gzip file.
///
/// A gzip member consists of a header, compressed data and a trailer. The [gzip
/// specification](https://tools.ietf.org/html/rfc1952), however, allows multiple
/// gzip members to be joined in a single stream. `MultiGzDecoder` will
/// decode all consecutive members while `GzDecoder` will only decompress
/// the first gzip member. The multistream format is commonly used in
/// bioinformatics, for example when using the BGZF compressed data.
/// When a [gzip file](https://www.rfc-editor.org/rfc/rfc1952#page-5) contains
/// multiple members, MultiGzDecoder will decode all of them, while [GzDecoder]
/// will only decode the first one.
///
/// This structure exposes a [`BufRead`] interface that will consume all gzip members
/// from the underlying reader and emit uncompressed data.
Expand Down
14 changes: 6 additions & 8 deletions src/gz/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ impl<R: Read + Write> Write for GzEncoder<R> {
}
}

/// A gzip streaming decoder
/// Decode a single member of a gzip file. Prefer [MultiGzDecoder] for
/// most uses.
///
/// This structure exposes a [`Read`] interface that will consume compressed
/// data from the underlying reader and emit uncompressed data.
Expand Down Expand Up @@ -180,14 +181,11 @@ impl<R: Read + Write> Write for GzDecoder<R> {
}
}

/// A gzip streaming decoder that decodes all members of a multistream
/// A gzip streaming decoder that decodes a full gzip file.
///
/// A gzip member consists of a header, compressed data and a trailer. The [gzip
/// specification](https://tools.ietf.org/html/rfc1952), however, allows multiple
/// gzip members to be joined in a single stream. `MultiGzDecoder` will
/// decode all consecutive members while `GzDecoder` will only decompress the
/// first gzip member. The multistream format is commonly used in bioinformatics,
/// for example when using the BGZF compressed data.
/// When a [gzip file](https://www.rfc-editor.org/rfc/rfc1952#page-5) contains
/// multiple members, MultiGzDecoder will decode all of them, while [GzDecoder]
/// will only decode the first one.
///
/// This structure exposes a [`Read`] interface that will consume all gzip members
/// from the underlying reader and emit uncompressed data.
Expand Down

0 comments on commit 70c30e6

Please sign in to comment.