Skip to content

Commit

Permalink
Improve doc
Browse files Browse the repository at this point in the history
  • Loading branch information
gyscos committed Oct 11, 2023
1 parent 47107c3 commit bd13b98
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/bulk/decompressor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl<'a> Decompressor<'a> {

/// Decompress a block of data, and return the result in a `Vec<u8>`.
///
/// The decompressed data should be less than `capacity` bytes,
/// The decompressed data should be at most `capacity` bytes,
/// or an error will be returned.
pub fn decompress(
&mut self,
Expand Down
2 changes: 1 addition & 1 deletion zstd-safe/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ debug = ["zstd-sys/debug"]
experimental = ["zstd-sys/experimental"]
legacy = ["zstd-sys/legacy"]
pkg-config = ["zstd-sys/pkg-config"]
std = ["zstd-sys/std"] # Use std instead of libc types - useful on wasm.
std = ["zstd-sys/std"] # Implements WriteBuf for std types like Cursor and Vec.
zstdmt = ["zstd-sys/zstdmt"]
thin = ["zstd-sys/thin"]
arrays = []
Expand Down
9 changes: 8 additions & 1 deletion zstd-safe/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ pub fn max_c_level() -> CompressionLevel {
/// Wraps the `ZSTD_compress` function.
///
/// This will try to compress `src` entirely and write the result to `dst`, returning the number of
/// bytes written.
/// bytes written. If `dst` is too small to hold the compressed content, an error will be returned.
///
/// For streaming operations that don't require to store the entire input/ouput in memory, see
/// `compress_stream`.
Expand All @@ -168,6 +168,13 @@ pub fn compress<C: WriteBuf + ?Sized>(
}

/// Wraps the `ZSTD_decompress` function.
///
/// This is a one-step decompression (not streaming).
///
/// You will need to make sure `dst` is large enough to store all the decompressed content, or an
/// error will be returned.
///
/// If decompression was a success, the number of bytes written will be returned.
pub fn decompress<C: WriteBuf + ?Sized>(
dst: &mut C,
src: &[u8],
Expand Down

0 comments on commit bd13b98

Please sign in to comment.