diff --git a/Cargo.toml b/Cargo.toml index d530317c..70d99e7b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ categories = ["compression", "api-bindings"] license = "MIT" name = "zstd" repository = "https://github.com/gyscos/zstd-rs" -version = "0.13.0" +version = "0.13.1" exclude = ["assets/*.zst", "/.github"] readme = "Readme.md" edition = "2018" @@ -20,7 +20,7 @@ features = ["experimental", "zstdmt", "zdict_builder", "doc-cfg"] travis-ci = { repository = "gyscos/zstd-rs" } [dependencies] -zstd-safe = { path = "zstd-safe", version = "7.0.0", default-features = false, features = ["std"] } +zstd-safe = { path = "zstd-safe", version = "7.1.0", default-features = false, features = ["std"] } [dev-dependencies] clap = {version = "4.0", features=["derive"]} diff --git a/src/stream/mod.rs b/src/stream/mod.rs index e2c04f66..2d3bc3ea 100644 --- a/src/stream/mod.rs +++ b/src/stream/mod.rs @@ -145,6 +145,22 @@ macro_rules! encoder_parameters { ) } + /// Sets the target size for compressed blocks. + /// + /// A lower block size may result in slightly lower speed (~2%) and compression ratio + /// (~0.1%), but may decrease end-to-end latency in low-bandwidth environments (time to + /// first decompressed byte). + /// + /// No value, or a value of zero, results in no contraint for the block sizes. + pub fn set_target_cblock_size( + &mut self, + target_size: Option, + ) -> io::Result<()> { + self.set_parameter(zstd_safe::CParameter::TargetCBlockSize( + target_size.unwrap_or(0), + )) + } + /// Sets the maximum back-reference distance. /// /// The actual maximum distance is going to be `2^log_distance`.