From 3ca5f62c3ff700ad1cf32f8f72eb4e1d3af6c3f4 Mon Sep 17 00:00:00 2001 From: Alexandre Bury Date: Wed, 27 Mar 2024 10:55:56 -0400 Subject: [PATCH] Bump zstd-safe to 7.1.0 --- zstd-safe/Cargo.toml | 4 ++-- zstd-safe/src/lib.rs | 23 ++++++++++++++--------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/zstd-safe/Cargo.toml b/zstd-safe/Cargo.toml index fa8bf427..35547cf7 100644 --- a/zstd-safe/Cargo.toml +++ b/zstd-safe/Cargo.toml @@ -2,7 +2,7 @@ authors = ["Alexandre Bury "] name = "zstd-safe" build = "build.rs" -version = "7.0.0" +version = "7.1.0" description = "Safe low-level bindings for the zstd compression library." keywords = ["zstd", "zstandard", "compression"] categories = ["api-bindings", "compression"] @@ -17,7 +17,7 @@ exclude = ["update_consts.sh"] features = ["experimental", "arrays", "std", "zdict_builder", "doc-cfg"] [dependencies] -zstd-sys = { path = "zstd-sys", version = "2.0.7", default-features = false } +zstd-sys = { path = "zstd-sys", version = "2.0.10", default-features = false } [features] default = ["legacy", "arrays", "zdict_builder"] diff --git a/zstd-safe/src/lib.rs b/zstd-safe/src/lib.rs index d170d9b1..7cae8264 100644 --- a/zstd-safe/src/lib.rs +++ b/zstd-safe/src/lib.rs @@ -610,7 +610,6 @@ impl<'a> CCtx<'a> { ZSTD_c_experimentalParam3 as ZSTD_c_forceMaxWindow, ZSTD_c_experimentalParam4 as ZSTD_c_forceAttachDict, ZSTD_c_experimentalParam5 as ZSTD_c_literalCompressionMode, - ZSTD_c_experimentalParam6 as ZSTD_c_targetCBlockSize, ZSTD_c_experimentalParam7 as ZSTD_c_srcSizeHint, ZSTD_c_experimentalParam8 as ZSTD_c_enableDedicatedDictSearch, ZSTD_c_experimentalParam9 as ZSTD_c_stableInBuffer, @@ -633,10 +632,6 @@ impl<'a> CCtx<'a> { (ZSTD_c_literalCompressionMode, mode as c_int) } #[cfg(feature = "experimental")] - TargetCBlockSize(value) => { - (ZSTD_c_targetCBlockSize, value as c_int) - } - #[cfg(feature = "experimental")] SrcSizeHint(value) => (ZSTD_c_srcSizeHint, value as c_int), #[cfg(feature = "experimental")] EnableDedicatedDictSearch(enable) => { @@ -680,6 +675,9 @@ impl<'a> CCtx<'a> { SearchForExternalRepcodes(value) => { (ZSTD_c_searchForExternalRepcodes, value as c_int) } + TargetCBlockSize(value) => { + (ZSTD_c_targetCBlockSize, value as c_int) + } CompressionLevel(level) => (ZSTD_c_compressionLevel, level), WindowLog(value) => (ZSTD_c_windowLog, value as c_int), HashLog(value) => (ZSTD_c_hashLog, value as c_int), @@ -1997,6 +1995,7 @@ pub enum ParamSwitch { /// A compression parameter. #[derive(Copy, Clone, Debug, PartialEq, Eq)] +#[non_exhaustive] pub enum CParameter { #[cfg(feature = "experimental")] #[cfg_attr(feature = "doc-cfg", doc(cfg(feature = "experimental")))] @@ -2018,10 +2017,6 @@ pub enum CParameter { #[cfg_attr(feature = "doc-cfg", doc(cfg(feature = "experimental")))] LiteralCompressionMode(ParamSwitch), - #[cfg(feature = "experimental")] - #[cfg_attr(feature = "doc-cfg", doc(cfg(feature = "experimental")))] - TargetCBlockSize(u32), - #[cfg(feature = "experimental")] #[cfg_attr(feature = "doc-cfg", doc(cfg(feature = "experimental")))] SrcSizeHint(u32), @@ -2074,6 +2069,14 @@ pub enum CParameter { #[cfg_attr(feature = "doc-cfg", doc(cfg(feature = "experimental")))] SearchForExternalRepcodes(ParamSwitch), + /// Target CBlock size. + /// + /// Tries to make compressed blocks fit in this size (not a guarantee, just a target). + /// Useful to reduce end-to-end latency in low-bandwidth environments. + /// + /// No target when the value is 0. + TargetCBlockSize(u32), + /// Compression level to use. /// /// Compression levels are global presets for the other compression parameters. @@ -2146,6 +2149,8 @@ pub enum CParameter { } /// A decompression parameter. +#[derive(Copy, Clone, Debug, PartialEq, Eq)] +#[non_exhaustive] pub enum DParameter { WindowLogMax(u32),