1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
pub mod read;
pub mod write;
mod functions;
pub mod zio;
#[cfg(test)]
mod tests;
pub mod raw;
pub use self::functions::{copy_decode, copy_encode, decode_all, encode_all};
pub use self::read::Decoder;
pub use self::write::{AutoFinishEncoder, Encoder};
#[doc(hidden)]
#[macro_export]
macro_rules! readwritecommon {
($readwrite:ident) => {
pub fn include_checksum(
&mut self,
include_checksum: bool,
) -> io::Result<()> {
self.$readwrite.operation_mut().set_parameter(
zstd_safe::CParameter::ChecksumFlag(include_checksum),
)
}
pub fn multithread(&mut self, n_workers: u32) -> io::Result<()> {
self.$readwrite
.operation_mut()
.set_parameter(zstd_safe::CParameter::NbWorkers(n_workers))
}
pub fn include_dictid(
&mut self,
include_dictid: bool,
) -> io::Result<()> {
self.$readwrite.operation_mut().set_parameter(
zstd_safe::CParameter::DictIdFlag(include_dictid),
)
}
pub fn include_contentsize(
&mut self,
include_contentsize: bool,
) -> io::Result<()> {
self.$readwrite.operation_mut().set_parameter(
zstd_safe::CParameter::ContentSizeFlag(include_contentsize),
)
}
pub fn long_distance_matching(
&mut self,
long_distance_matching: bool,
) -> io::Result<()> {
self.$readwrite.operation_mut().set_parameter(
zstd_safe::CParameter::EnableLongDistanceMatching(
long_distance_matching,
),
)
}
#[cfg(feature = "experimental")]
pub fn include_magicbytes(
&mut self,
include_magicbytes: bool,
) -> io::Result<()> {
self.$readwrite.operation_mut().set_parameter(
if include_magicbytes {
zstd_safe::CParameter::Format(zstd_safe::FrameFormat::One)
} else {
zstd_safe::CParameter::Format(
zstd_safe::FrameFormat::Magicless,
)
},
)
}
};
}