11//! This module contains zstd-specific types for async-compression.
22
3- use libzstd:: stream:: raw:: CParameter :: * ;
4- use libzstd:: stream:: raw:: DParameter :: * ;
5-
63/// A compression parameter for zstd. This is a stable wrapper around zstd's own `CParameter`
74/// type, to abstract over different versions of the zstd library.
85///
@@ -14,74 +11,74 @@ pub struct CParameter(libzstd::stream::raw::CParameter);
1411impl CParameter {
1512 /// Window size in bytes (as a power of two)
1613 pub fn window_log ( value : u32 ) -> Self {
17- Self ( WindowLog ( value) )
14+ Self ( libzstd :: stream :: raw :: CParameter :: WindowLog ( value) )
1815 }
1916
2017 /// Size of the initial probe table in 4-byte entries (as a power of two)
2118 pub fn hash_log ( value : u32 ) -> Self {
22- Self ( HashLog ( value) )
19+ Self ( libzstd :: stream :: raw :: CParameter :: HashLog ( value) )
2320 }
2421
2522 /// Size of the multi-probe table in 4-byte entries (as a power of two)
2623 pub fn chain_log ( value : u32 ) -> Self {
27- Self ( ChainLog ( value) )
24+ Self ( libzstd :: stream :: raw :: CParameter :: ChainLog ( value) )
2825 }
2926
3027 /// Number of search attempts (as a power of two)
3128 pub fn search_log ( value : u32 ) -> Self {
32- Self ( SearchLog ( value) )
29+ Self ( libzstd :: stream :: raw :: CParameter :: SearchLog ( value) )
3330 }
3431
3532 /// Minimum size of matches searched for
3633 pub fn min_match ( value : u32 ) -> Self {
37- Self ( MinMatch ( value) )
34+ Self ( libzstd :: stream :: raw :: CParameter :: MinMatch ( value) )
3835 }
3936
4037 /// Strategy-dependent length modifier
4138 pub fn target_length ( value : u32 ) -> Self {
42- Self ( TargetLength ( value) )
39+ Self ( libzstd :: stream :: raw :: CParameter :: TargetLength ( value) )
4340 }
4441
4542 /// Enable long-distance matching mode to look for and emit long-distance references.
4643 ///
4744 /// This increases the default window size.
4845 pub fn enable_long_distance_matching ( value : bool ) -> Self {
49- Self ( EnableLongDistanceMatching ( value) )
46+ Self ( libzstd :: stream :: raw :: CParameter :: EnableLongDistanceMatching ( value) )
5047 }
5148
5249 /// Size of the long-distance matching table (as a power of two)
5350 pub fn ldm_hash_log ( value : u32 ) -> Self {
54- Self ( LdmHashLog ( value) )
51+ Self ( libzstd :: stream :: raw :: CParameter :: LdmHashLog ( value) )
5552 }
5653
5754 /// Minimum size of long-distance matches searched for
5855 pub fn ldm_min_match ( value : u32 ) -> Self {
59- Self ( LdmMinMatch ( value) )
56+ Self ( libzstd :: stream :: raw :: CParameter :: LdmMinMatch ( value) )
6057 }
6158
6259 /// Size of each bucket in the LDM hash table for collision resolution (as a power of two)
6360 pub fn ldm_bucket_size_log ( value : u32 ) -> Self {
64- Self ( LdmBucketSizeLog ( value) )
61+ Self ( libzstd :: stream :: raw :: CParameter :: LdmBucketSizeLog ( value) )
6562 }
6663
6764 /// Frequency of using the LDM hash table (as a power of two)
6865 pub fn ldm_hash_rate_log ( value : u32 ) -> Self {
69- Self ( LdmHashRateLog ( value) )
66+ Self ( libzstd :: stream :: raw :: CParameter :: LdmHashRateLog ( value) )
7067 }
7168
7269 /// Emit the size of the content (default: true).
7370 pub fn content_size_flag ( value : bool ) -> Self {
74- Self ( ContentSizeFlag ( value) )
71+ Self ( libzstd :: stream :: raw :: CParameter :: ContentSizeFlag ( value) )
7572 }
7673
7774 /// Emit a checksum (default: false).
7875 pub fn checksum_flag ( value : bool ) -> Self {
79- Self ( ChecksumFlag ( value) )
76+ Self ( libzstd :: stream :: raw :: CParameter :: ChecksumFlag ( value) )
8077 }
8178
8279 /// Emit a dictionary ID when using a custom dictionary (default: true).
8380 pub fn dict_id_flag ( value : bool ) -> Self {
84- Self ( DictIdFlag ( value) )
81+ Self ( libzstd :: stream :: raw :: CParameter :: DictIdFlag ( value) )
8582 }
8683
8784 /// Number of threads to spawn.
@@ -97,14 +94,14 @@ impl CParameter {
9794 // TODO: make this a normal feature guarded fn on next breaking release
9895 #[ cfg_attr( docsrs, doc( cfg( feature = "zstdmt" ) ) ) ]
9996 pub fn nb_workers ( value : u32 ) -> Self {
100- Self ( NbWorkers ( value) )
97+ Self ( libzstd :: stream :: raw :: CParameter :: NbWorkers ( value) )
10198 }
10299
103100 /// Number of bytes given to each worker.
104101 ///
105102 /// If set to 0, zstd selects a job size based on compression parameters.
106103 pub fn job_size ( value : u32 ) -> Self {
107- Self ( JobSize ( value) )
104+ Self ( libzstd :: stream :: raw :: CParameter :: JobSize ( value) )
108105 }
109106
110107 pub ( crate ) fn as_zstd ( & self ) -> libzstd:: stream:: raw:: CParameter {
@@ -123,7 +120,7 @@ pub struct DParameter(libzstd::stream::raw::DParameter);
123120impl DParameter {
124121 /// Maximum window size in bytes (as a power of two)
125122 pub fn window_log_max ( value : u32 ) -> Self {
126- Self ( WindowLogMax ( value) )
123+ Self ( libzstd :: stream :: raw :: DParameter :: WindowLogMax ( value) )
127124 }
128125
129126 pub ( crate ) fn as_zstd ( & self ) -> libzstd:: stream:: raw:: DParameter {
0 commit comments