1#[derive(Debug, Clone, Copy)]
12pub struct CodecOptions {
13 validate_checksums: bool,
14 store_empty_chunks: bool,
15 concurrent_target: usize,
16 chunk_concurrent_minimum: usize,
17 experimental_partial_encoding: bool,
18}
19
20impl Default for CodecOptions {
21 fn default() -> Self {
22 Self {
23 validate_checksums: true,
24 store_empty_chunks: false,
25 concurrent_target: rayon::current_num_threads(),
26 chunk_concurrent_minimum: 4,
27 experimental_partial_encoding: false,
28 }
29 }
30}
31
32impl CodecOptions {
33 #[must_use]
35 pub fn validate_checksums(&self) -> bool {
36 self.validate_checksums
37 }
38
39 pub fn set_validate_checksums(&mut self, validate_checksums: bool) -> &mut Self {
41 self.validate_checksums = validate_checksums;
42 self
43 }
44
45 #[must_use]
47 pub fn with_validate_checksums(mut self, validate_checksums: bool) -> Self {
48 self.validate_checksums = validate_checksums;
49 self
50 }
51
52 #[must_use]
54 pub fn store_empty_chunks(&self) -> bool {
55 self.store_empty_chunks
56 }
57
58 pub fn set_store_empty_chunks(&mut self, store_empty_chunks: bool) -> &mut Self {
60 self.store_empty_chunks = store_empty_chunks;
61 self
62 }
63
64 #[must_use]
66 pub fn with_store_empty_chunks(mut self, store_empty_chunks: bool) -> Self {
67 self.store_empty_chunks = store_empty_chunks;
68 self
69 }
70
71 #[must_use]
73 pub fn concurrent_target(&self) -> usize {
74 self.concurrent_target
75 }
76
77 pub fn set_concurrent_target(&mut self, concurrent_target: usize) -> &mut Self {
79 self.concurrent_target = concurrent_target;
80 self
81 }
82
83 #[must_use]
85 pub fn with_concurrent_target(mut self, concurrent_target: usize) -> Self {
86 self.concurrent_target = concurrent_target;
87 self
88 }
89
90 #[must_use]
96 pub fn chunk_concurrent_minimum(&self) -> usize {
97 self.chunk_concurrent_minimum
98 }
99
100 pub fn set_chunk_concurrent_minimum(&mut self, chunk_concurrent_minimum: usize) -> &mut Self {
102 self.chunk_concurrent_minimum = chunk_concurrent_minimum;
103 self
104 }
105
106 #[must_use]
108 pub fn with_chunk_concurrent_minimum(mut self, chunk_concurrent_minimum: usize) -> Self {
109 self.chunk_concurrent_minimum = chunk_concurrent_minimum;
110 self
111 }
112
113 #[must_use]
115 pub fn experimental_partial_encoding(&self) -> bool {
116 self.experimental_partial_encoding
117 }
118
119 pub fn set_experimental_partial_encoding(
121 &mut self,
122 experimental_partial_encoding: bool,
123 ) -> &mut Self {
124 self.experimental_partial_encoding = experimental_partial_encoding;
125 self
126 }
127
128 #[must_use]
130 pub fn with_experimental_partial_encoding(
131 mut self,
132 experimental_partial_encoding: bool,
133 ) -> Self {
134 self.experimental_partial_encoding = experimental_partial_encoding;
135 self
136 }
137}
138
139#[derive(Debug, Clone, Copy)]
141pub struct CodecMetadataOptions {
142 codec_store_metadata_if_encode_only: bool,
143}
144
145impl Default for CodecMetadataOptions {
146 fn default() -> Self {
147 Self {
148 codec_store_metadata_if_encode_only: true,
149 }
150 }
151}
152
153impl CodecMetadataOptions {
154 #[must_use]
156 pub fn codec_store_metadata_if_encode_only(&self) -> bool {
157 self.codec_store_metadata_if_encode_only
158 }
159
160 #[must_use]
162 pub fn with_codec_store_metadata_if_encode_only(mut self, enabled: bool) -> Self {
163 self.codec_store_metadata_if_encode_only = enabled;
164 self
165 }
166
167 pub fn set_codec_store_metadata_if_encode_only(&mut self, enabled: bool) -> &mut Self {
169 self.codec_store_metadata_if_encode_only = enabled;
170 self
171 }
172}